class HierarchicalEntityManager {

    public Map<AclClass, List<AbstractSecuredEntity>> loadAvailable(final AclSid aclSid, final AclClass aclClass) {
        log.debug("Retrieving whole hierarchy of all available objects for SID: " + aclSid.getName());
        final List<AbstractHierarchicalEntity> allHierarchy = loadEntities(aclClass)
                .stream()
                .peek(h -> permissionManager.filterTree(aclSid, h, AclPermission.READ))
                .collect(Collectors.toList());

        log.debug("Flatten trees to map by AclClass");
        return flattenHierarchy(allHierarchy, aclClass)
                .stream()
                .collect(Collectors.groupingBy(AbstractSecuredEntity::getAclClass));
    }

}