public ActionResult Edit(int id, StateUpdateModel model)
        {
            var state = StatesService.GetStateByStateId(id);

            if (ModelState.IsValid)
            {
                try
                {
                    state.StateCode = model.StateCode;
                    state.StateName = model.StateName;
                    state.ContiguousLand = model.ContiguousLand ? "1" : "0";
                    state.IsTerritory = model.IsTerritory ? "1" : "0";

                    state = StatesService.Update(state);

                    this.FlashInfo(string.Format("State {0} was updated successfully", state.StateName));
                    return RedirectToAction("Index");
                }
                catch (ErrorException errorException)
                {
                    errorException.ToModelState(this);
                    return View(model);
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return View(model);
                }
            }

            return RedirectToAction("Index");
        }
        public ActionResult Edit(int id)
        {
            var state = StatesService.GetStateByStateId(id);
            if (state != null)
            {
                var model = new StateUpdateModel(state);
                return View(model);
            }

            return RedirectToAction("Index");
        }