class PartnerOrganisationServiceImpl implements PartnerOrganisationService {

    @Override
    @Transactional
    public ServiceResult<Void> removePartnerOrganisation(ProjectOrganisationCompositeId projectOrganisationCompositeId) {
        return find(partnerOrganisationRepository.findOneByProjectIdAndOrganisationId(projectOrganisationCompositeId.getProjectId(), projectOrganisationCompositeId.getOrganisationId()),
                notFoundError(PartnerOrganisation.class)).andOnSuccess(
                projectPartner -> validatePartnerNotLead(projectPartner).andOnSuccessReturnVoid(
                        () -> {
                            removePartnerOrg(projectOrganisationCompositeId.getProjectId(), projectPartner.getOrganisation().getId());
                            projectPartnerChangeService.updateProjectWhenPartnersChange(projectOrganisationCompositeId.getProjectId());
                            removePartnerNotificationService.sendNotifications(projectPartner.getProject(), projectPartner.getOrganisation());
                        })
        );
    }

}