public static <T> T updateModuleGroupPath(final ModuleGroup group,
                                            T parentNode,
                                            final Function<? super ModuleGroup, ? extends T> needToCreateNode,
                                            final Consumer<? super ParentChildRelation<T>> insertNode,
                                            final Function<? super ModuleGroup, ? extends T> createNewNode) {
    final List<String> groupPath = group.getGroupPathList();
    for (int i = 0; i < groupPath.size(); i++) {
      final ModuleGroup moduleGroup = new ModuleGroup(groupPath.subList(0, i+1));
      T moduleGroupNode = needToCreateNode.fun(moduleGroup);
      if (moduleGroupNode == null) {
        moduleGroupNode = createNewNode.fun(moduleGroup);
        insertNode.consume(new ParentChildRelation<>(parentNode, moduleGroupNode));
      }
      parentNode = moduleGroupNode;
    }
    return parentNode;
  }
public static <T> T updateModuleGroupPath(final ModuleGroup group,
                                            T parentNode,
                                            final Function<? super ModuleGroup, ? extends T> needToCreateNode,
                                            final Consumer<? super ParentChildRelation<T>> insertNode,
                                            final Function<? super ModuleGroup, ? extends T> createNewNode)