class CompetitionSetupOrganisationalEligibilityController {

    @PostMapping("/lead-international-organisation")
    public String submitLeadInternationalOrganisationDetails(@PathVariable("competitionId") long competitionId,
                                                             @Valid @ModelAttribute LeadInternationalOrganisationForm leadInternationalOrganisationForm,
                                                             BindingResult bindingResult,
                                                             ValidationHandler validationHandler,
                                                             Model model) {

        CompetitionResource competition = competitionRestService.getCompetitionById(competitionId).getSuccess();
        CompetitionOrganisationConfigResource configResource = competitionOrganisationConfigRestService.findByCompetitionId(competitionId).getSuccess();

        Supplier<String> failureView = () -> {
            model.addAttribute("model", leadInternationalOrganisationViewModelPopulator.populateModel(competition.getId(), configResource));
            return "competition/setup/lead-international-organisation";
        };

        Supplier<String> successView = () -> {
            return validationHandler.addAnyErrors(saveOrganisationConfig(competition, leadInternationalOrganisationForm), fieldErrorsToFieldErrors(), asGlobalErrors())
                    .failNowOrSucceedWith(failureView, () ->
                            format("redirect:/competition/setup/%d/section/%s", competition.getId(), ORGANISATIONAL_ELIGIBILITY.getPostMarkCompletePath()));
        };

        return validationHandler.failNowOrSucceedWith(failureView, successView);
    }

}