class CompetitionSetupStakeholderController {

    @PostMapping(value = "/{competitionId}/manage-stakeholders", params = {"inviteStakeholder"})
    public String inviteStakeholder(@PathVariable(COMPETITION_ID_KEY) long competitionId,
                                    @RequestParam(value = "tab", defaultValue = DEFAULT_TAB) String tab,
                                    Model model,
                                    @Valid @ModelAttribute(FORM_ATTR_NAME) InviteStakeholderForm form,
                                    @SuppressWarnings("unused") BindingResult bindingResult, ValidationHandler validationHandler) {

        Supplier<String> failureView = () -> doViewManageStakeholders(competitionId, model, form, tab);
        form.setVisible(true);

        return validationHandler.failNowOrSucceedWith(failureView, () -> {
            InviteUserResource inviteUserResource = constructInviteUserResource(form);
            RestResult<Void> saveResult = competitionSetupStakeholderRestService.inviteStakeholder(inviteUserResource, competitionId);
            return handleInviteStakeholderErrors(saveResult, validationHandler, form).
                    failNowOrSucceedWith(failureView, () -> "redirect:/competition/setup/" + competitionId + "/manage-stakeholders?tab=" + tab);
        });
    }

}