class ProjectStateServiceImpl extends BaseTransactionalService implements ProjectStateService {

    @Override
    @Transactional
    public ServiceResult<Void> putProjectOnHold(long projectId, OnHoldReasonResource reason) {
        return getProject(projectId).andOnSuccess(
                project -> getCurrentlyLoggedInUser().andOnSuccess(user ->
                        projectWorkflowHandler.putProjectOnHold(project, user) ?
                                serviceSuccess() : serviceFailure(PROJECT_CANNOT_BE_PUT_ON_HOLD))
        ).andOnSuccessReturnVoid(() -> projectStateCommentsService.create(projectId, ProjectState.ON_HOLD, reason));
    }

}