private ActionResult Delete(DelegationUser[] users)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    foreach (var user in users.Where(x => x.Delete))
                    {
                        var settings = this.delegationRepository.GetDelegationSettingsForUser(user.Username);
                        foreach (var setting in settings)
                        {
                            this.delegationRepository.Delete(setting);
                        }
                    }
                    TempData["Message"] = "Delegation Users Deleted";
                    return RedirectToAction("Index");
                }
                catch (ValidationException ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
                catch (Exception)
                {
                    ModelState.AddModelError("", "Error deleting delegation users.");
                }
            }

            return Index();
        }
 public ActionResult Index(string action, DelegationUser[] users)
 {
     if (action == "new") return Configure();
     if (action == "delete") return Delete(users);
     return RedirectToAction("Index");
 }