private void removeDuplicates(List<DiagramElementTreeNode> children) {
    List<DiagramElementTreeNode> duplicates = new ArrayList<DiagramElementTreeNode>();
    for (DiagramElementTreeNode node : children) {
      if (node.hasChildren()) removeDuplicates(node.getChildren());

      BaseElement be = node.getBaseElement();
      if (be instanceof Collaboration) {
        Collaboration c = (Collaboration) be;
        for (Participant p : c.getParticipants()) {
          for (DiagramElementTreeNode n : children) {
            if (n.getBaseElement() == p.getProcessRef()) {
              duplicates.add(n);
            }
          }
        }
      } else if (be instanceof ChoreographyActivity) {
        ChoreographyActivity c = (ChoreographyActivity) be;
        for (Participant p : c.getParticipantRefs()) {
          for (DiagramElementTreeNode n : children) {
            if (n.getBaseElement() == p) {
              duplicates.add(n);
            }
          }
        }
      }
    }
    if (!duplicates.isEmpty()) children.removeAll(duplicates);
  }
 private int createMissingDIElementChildren(
     DiagramElementTreeNode node, int x, int y, List<BaseElement> created) {
   for (DiagramElementTreeNode childNode : node.getChildren()) {
     if (childNode.getChecked()) {
       BPMNShape bpmnShape = createMissingDIElement(childNode, x, y, created);
       if (bpmnShape != null) {
         y += bpmnShape.getBounds().getHeight() + 10;
       }
     }
   }
   return y;
 }