public ActionResult LearnTypePost(string id, string language, string db, List <string> contentFields) { if (!IsSitecoreUser()) { return(LoginPage()); } if (contentFields.Contains("")) { return(Json(new { Failed = true, Message = "No Content Fields were selected." })); } Item currentItem = DataWrapper.GetItemByIdValue(id, db); if (currentItem == null) { return(Json(new { Failed = true, Message = $"Item Id:{id} or Datbase:{db} is not correct." })); } foreach (var f in contentFields) { if (currentItem.Fields[f] == null) { return(Json(new { Failed = true, Message = $"Content Field:{f} is not a field on this item." })); } } Item newMapping = ContentService.AddMapping(db, currentItem.TemplateName, contentFields.Select(a => currentItem.Fields[a].ID.ToString()).ToList(), currentItem.TemplateID.ToString()); if (newMapping == null) { return(Json(new { Failed = true, Message = "Item type was not learned." })); } return(Json(new { Failed = false })); }