class ProjectStateServiceImpl extends BaseTransactionalService implements ProjectStateService {

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

}