private ModelStateDictionary ConvertToModelState(System.Web.Mvc.ModelStateDictionary state) { ModelStateDictionary ret = new ModelStateDictionary(); foreach (var list in state.ToList()) { for (int i = 0; i < list.Value.Errors.Count; i++) { ret.AddModelError(list.Key, list.Value.Errors[i].ErrorMessage); } } return(ret); }