public async Task <IActionResult> EditChild(PostChildEditModel child)
        {
            var user = await userManager.GetUserAsync(User);

            if (user == null ||
                !(await userManager.IsInRoleAsync(user, UserHelpers.UserRoles.VolunteerCaptain.ToString()) ||
                  await userManager.IsInRoleAsync(user, UserHelpers.UserRoles.BusDriver.ToString()) ||
                  await userManager.IsInRoleAsync(user, UserHelpers.UserRoles.Staff.ToString())))
            {
                return(Utilities.ErrorJson("Not authorized."));
            }

            if (child == null || child.Id == 0)
            {
                return(Utilities.GenerateMissingInputMessage("child id"));
            }

            try
            {
                ChildRepository    repo         = new ChildRepository(configModel.ConnectionString);
                PostChildEditModel updatedChild = repo.EditChild(child);
                return(new JsonResult(new PostChildEditModel
                {
                    Id = updatedChild.Id,
                    // Fields that can be updated:
                    FirstName = updatedChild.FirstName,
                    LastName = updatedChild.LastName,
                    PreferredName = updatedChild.LastName,
                    ContactNumber = updatedChild.ContactNumber,
                    ContactEmail = updatedChild.ContactEmail,
                    ParentName = updatedChild.ParentName,
                    BusId = updatedChild.BusId,
                    Birthday = updatedChild.Birthday,
                    Gender = updatedChild.Gender,
                    Grade = updatedChild.Grade,
                    ParentalWaiver = updatedChild.ParentalWaiver,
                    ClassId = updatedChild.ClassId,
                    Picture = updatedChild.Picture,
                    BusWaiver = updatedChild.BusWaiver,
                    HaircutWaiver = updatedChild.HaircutWaiver,
                    ParentalEmailOptIn = updatedChild.ParentalEmailOptIn,
                    OrangeShirtStatus = updatedChild.OrangeShirtStatus
                }));
            }
            catch (Exception exc)
            {
                return(new JsonResult(new
                {
                    Error = exc.Message,
                }));
            }
        }