code: private boolean findAndMoveParentWithChildren(
          Set<CmsResource> originalSet,
          ResourceMap reachability,
          ResourceMap result) {
  
          for (CmsResource parent : originalSet) {
              Set<CmsResource> reachableResources = reachability.get(parent);
              Set<CmsResource> children = Sets.newHashSet();
              if (reachableResources.size() > 1) {
                  for (CmsResource potentialChild : reachableResources) {
                      if ((potentialChild != parent) && originalSet.contains(potentialChild)) {
                          children.add(potentialChild);
                      }
                  }
                  if (children.size() > 0) {
                      result.get(parent).addAll(children);
                      originalSet.removeAll(children);
                      originalSet.remove(parent);
                      return true;
                  }
              }
          }
          return false;
  
      }
docs: Tries to find a parent with related children in a set, and moves them to a result ResourceMap.<p>
  
  @param originalSet the original set
  @param reachability the reachability ResourceMap
  @param result the target ResourceMap to move the parent/children to
  
  @return true if a parent with children could be found (and moved)