class OrganisationServiceImpl implements OrganisationService {

    @Override
    public Optional<OrganisationResource> getOrganisationForUser(long userId, List<ProcessRoleResource> userApplicationRoles) {
        return userApplicationRoles.stream()
            .filter(uar -> uar.getUser().equals(userId))
            .filter(uar -> uar.getOrganisationId() != null)
            .map(uar -> organisationRestService.getOrganisationById(uar.getOrganisationId()).getOptionalSuccessObject())
            .filter(Optional::isPresent)
            .map(Optional::get)
            .findFirst();
    }

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

}