class OrganisationServiceImpl implements OrganisationService {

    @Override
    public SortedSet<OrganisationResource> getApplicationOrganisations(List<ProcessRoleResource> userApplicationRoles) {
        Comparator<OrganisationResource> compareById =
                Comparator.comparingLong(OrganisationResource::getId);
        Supplier<SortedSet<OrganisationResource>> supplier = () -> new TreeSet<>(compareById);

        return userApplicationRoles.stream()
                .filter(uar -> uar.getRoleName().equals(Role.LEADAPPLICANT.getName())
                        || uar.getRoleName().equals(Role.COLLABORATOR.getName()))
                .map(uar -> organisationRestService.getOrganisationById(uar.getOrganisationId()).getSuccess())
                .collect(Collectors.toCollection(supplier));
    }

    public  OrganisationServiceImpl(OrganisationRestService organisationRestService,
                                   UserRestService userRestService, UserService userService);

}