class LdapGroupUtils {

    public Set<LdapGroup> findAscendantsForLdapGroupNode(LdapGroupNode targetNode, Set<LdapGroup> ldapGroups)
    {
        Set<LdapGroupNode> allNodes = ldapGroups.stream()
                .map(LdapGroupNode::new)
                .collect(Collectors.toSet());

        return allNodes.stream()
                .flatMap(node -> findAscendantsStream(targetNode, node))
                .map(LdapGroupNode::getLdapGroup)
                .collect(Collectors.toSet());
    }

}