public ActionResult Index(string action, DelegationUser[] users)
 {
     if (action == "new") return Configure();
     if (action == "delete") return Delete(users);
     return RedirectToAction("Index");
 }
        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"] = Resources.DelegationController.DelegationUsersDeleted;
                    return RedirectToAction("Index");
                }
                catch (ValidationException ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
                catch (Exception)
                {
                    ModelState.AddModelError("", Resources.DelegationController.ErrorDeletingDelegationUsers);
                }
            }

            return Index();
        }