public ActionResult Index()
 {
     IList<Config> configs = systemService.GetAllConfigs();
     List<Config> list = null;
     EditSettingsInfo info = new EditSettingsInfo();
     foreach (var item in configs)
     {
         if (!info.Settings.ContainsKey(item.Group))
         {
             list = new List<Config>();
             info.Settings.Add(item.Group, list);
         }
         else
         {
             list = info.Settings[item.Group];
         }
         list.Add(item);
     }
     return View(info);
 }
        public ActionResult Index(FormCollection formCollection)
        {
            try
            {
                IDictionary<string, string> updateConfigs = new Dictionary<string, string>();
                foreach (var item in formCollection.AllKeys)
                {
                    updateConfigs.Add(item, formCollection[item]);
                }
                systemService.SaveConfigs(updateConfigs);
                TempData.Add("SuccessMessage", "System configuration was updated.");
                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                ModelState.AddBusinessError(ex.Message);
            }

            IList<Config> configs = systemService.GetAllConfigs();
            List<Config> list = null;
            EditSettingsInfo info = new EditSettingsInfo();
            foreach (var item in configs)
            {
                if (!info.Settings.ContainsKey(item.Group))
                {
                    list = new List<Config>();
                    info.Settings.Add(item.Group, list);
                }
                else
                {
                    list = info.Settings[item.Group];
                }
                list.Add(new Config() { Name = item.Name, Value = formCollection[item.Name], Group = item.Group });
            }
            return RedirectToActionWithError("Index", info);
        }