class InviteAssessorsController extends CompetitionManagementCookieController<AssessorSelectionForm> {

    @PostMapping(value = "/invite", params = {"inviteNewUsers"})
    public String inviteNewUsersFromInviteView(Model model,
                                               @PathVariable("competitionId") long competitionId,
                                               @RequestParam(defaultValue = "0") int page,
                                               @Valid @ModelAttribute(FORM_ATTR_NAME) InviteNewAssessorsForm form,
                                               @SuppressWarnings("unused") BindingResult bindingResult,
                                               ValidationHandler validationHandler) {
        form.setVisible(true);

        return validationHandler.failNowOrSucceedWith(
                () -> invite(model, competitionId, form, page),
                () -> {
                    RestResult<Void> restResult = competitionInviteRestService.inviteNewUsers(
                            newInviteFormToResource(form, competitionId), competitionId
                    );

                    return validationHandler.addAnyErrors(restResult)
                            .failNowOrSucceedWith(
                                    () -> invite(model, competitionId, form, page),
                                    () -> redirectToInvite(competitionId, page)
                            );
                }
        );
    }

}