code: private void addConnectionGroups(Collection<ConnectionGroup> connectionGroups) {
  
          // Add each connection group to the tree
          for (ConnectionGroup connectionGroup : connectionGroups) {
  
              // Retrieve the connection group's parent group
              APIConnectionGroup parent = retrievedGroups.get(connectionGroup.getParentIdentifier());
              if (parent != null) {
  
                  Collection<APIConnectionGroup> children = parent.getChildConnectionGroups();
                  
                  // Create child collection if it does not yet exist
                  if (children == null) {
                      children = new ArrayList<APIConnectionGroup>();
                      parent.setChildConnectionGroups(children);
                  }
  
                  // Add child
                  APIConnectionGroup apiConnectionGroup = new APIConnectionGroup(connectionGroup);
                  retrievedGroups.put(connectionGroup.getIdentifier(), apiConnectionGroup);
                  children.add(apiConnectionGroup);
                  
              }
  
              // Warn of internal consistency issues
              else
                  logger.debug("Connection group \"{}\" cannot be added to the tree: parent \"{}\" does not actually exist.",
                          connectionGroup.getIdentifier(),
                          connectionGroup.getParentIdentifier());
  
          } // end for each connection group
          
      }
docs: Adds each of the provided connection groups to the current tree as
  children of their respective parents. The parent connection groups must
  already be added.
  
  @param connectionGroups
  The connection groups to add to the tree.