public ActionResult GetStates() { try { var add = new KeyContent(0, "Select a State"); var items = CustomManager.GetStates(); if (items == null || !items.Any()) { return(Json(new List <KeyContent> { add }, JsonRequestBehavior.AllowGet)); } var jsonitem = items.Select(o => new KeyContent(o.StateId, o.Name)).ToList(); jsonitem.Insert(0, add); return(Json(jsonitem, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { BugManager.LogApplicationBug(ex.StackTrace, ex.Source, ex.Message); return(Json(new List <KeyContent>(), JsonRequestBehavior.AllowGet)); } }