public static void mergeDataModel(FormInstance parent, FormInstance child, TreeReference parentRef) { TreeElement parentNode = parent.resolveReference(parentRef); //ugly if (parentNode == null) { parentRef = parent.addNode(parentRef); parentNode = parent.resolveReference(parentRef); } TreeElement childNode = child.getRoot(); int mult = parentNode.getChildMultiplicity(childNode.getName()); childNode.setMult(mult); parentNode.addChild(childNode); }