class CompetitionSetupServiceImpl implements CompetitionSetupService {

    @Override
    public ServiceResult<Void> saveCompetitionSetupSection(CompetitionSetupForm competitionSetupForm,
                                                           CompetitionResource competitionResource,
                                                           CompetitionSetupSection section) {
        checkCompetitionInitialDetailsComplete(competitionResource, section);

        CompetitionSetupSectionUpdater saver = sectionSavers.get(section);
        if (saver == null || !saver.supportsForm(competitionSetupForm.getClass())) {
            LOG.error("unable to save section " + section);
            throw new IllegalArgumentException();
        }

        return saver.saveSection(competitionResource, competitionSetupForm).andOnSuccess(() -> {
            if (competitionSetupForm.isMarkAsCompleteAction()) {
                return competitionSetupRestService.markSectionComplete(competitionResource.getId(), section).toServiceResult();
            }
            return serviceSuccess();
        });
    }

}