class SpendProfileServiceImpl extends BaseTransactionalService implements SpendProfileService {

    @Override
    @Transactional
    public ServiceResult<Void> markSpendProfileComplete(ProjectOrganisationCompositeId projectOrganisationCompositeId) {
        SpendProfileTableResource table = getSpendProfileTable(projectOrganisationCompositeId).getSuccess();
        if (table.getValidationMessages().hasErrors()) { // validate before marking as complete
            return serviceFailure(SPEND_PROFILE_CANNOT_MARK_AS_COMPLETE_BECAUSE_SPEND_HIGHER_THAN_ELIGIBLE);
        } else {
            return saveSpendProfileData(projectOrganisationCompositeId, table, true);
        }
    }

}