class OrganizationalAccountAvailableResourcesProvider implements AvailableResourcesProvider {

  @VisibleForTesting
  List<Resource> getUsedResourcesBySuborganizations(String parentQualifiedName)
      throws NotFoundException, ServerException {
    ResourceManager resourceManager = resourceManagerProvider.get();
    List<Resource> usedResources = new ArrayList<>();
    for (Organization suborganization :
        Pages.iterate(
            (maxItems, skipCount) ->
                organizationManager.getSuborganizations(
                    parentQualifiedName, maxItems, skipCount))) {
      usedResources.addAll(resourceManager.getUsedResources(suborganization.getId()));
    }
    return usedResources;
  }

  @Inject public  OrganizationalAccountAvailableResourcesProvider(
      Provider<ResourceManager> resourceManagerProvider,
      ResourceAggregator resourceAggregator,
      OrganizationManager organizationManager);

}