class CompetitionSetupStakeholderServiceImpl extends BaseTransactionalService implements CompetitionSetupStakeholderService {

    @Override
    @Transactional
    public ServiceResult<Void> inviteStakeholder(UserResource invitedUser, long competitionId) {

        return validateInvite(invitedUser)
                .andOnSuccess(() -> validateUserIsNotInternal(invitedUser.getEmail()))
                .andOnSuccess(() -> validateUserInviteNotPending(competitionId, invitedUser))
                .andOnSuccess(() -> validateUserNotAlreadyStakeholderOnCompetition(competitionId, invitedUser.getEmail()))
                .andOnSuccess(() -> getCompetition(competitionId))
                .andOnSuccess(competition -> addOrInviteUser(competition, invitedUser)
                );
    }

}