private IActionResult ReturnToEditDetailsViewWithErrors(
            EditDelegateFormData formData,
            int delegateId,
            int centreId
            )
        {
            var jobGroups     = jobGroupsDataService.GetJobGroupsAlphabetical().ToList();
            var customPrompts =
                promptsService.GetEditDelegateRegistrationPromptViewModelsForCentre(formData, centreId);
            var model = new EditDelegateViewModel(formData, jobGroups, customPrompts, delegateId);

            return(View(model));
        }
        public IActionResult Index(int delegateId)
        {
            var centreId     = User.GetCentreId();
            var delegateUser = userService.GetUsersById(null, delegateId).delegateUser;

            if (delegateUser == null || delegateUser.CentreId != centreId)
            {
                return(NotFound());
            }

            var jobGroups = jobGroupsDataService.GetJobGroupsAlphabetical().ToList();

            var customPrompts =
                promptsService.GetEditDelegateRegistrationPromptViewModelsForCentre(delegateUser, centreId);
            var model = new EditDelegateViewModel(delegateUser, jobGroups, customPrompts);

            return(View(model));
        }