public JsonNetResult CreateCategory(List <TranslatedCategory> transdesc, Guid?parentID) { try { //2015-09-08 //Ivan S. //66 //Sets the initial order for the new category to the maximum number for all the categories var lastCategory = Exigo.GetResourceCategories(new GetResourceCategoriesRequest()).OrderByDescending(rc => rc.CategoryOrder).FirstOrDefault(); int?lastCategoryOrder = InitialOrderValue - 1; if (lastCategory != null) { lastCategoryOrder = lastCategory.CategoryOrder; } var NewOrder = ++lastCategoryOrder; var CategoryID = Guid.NewGuid(); if (parentID == null) { parentID = Guid.Empty; } foreach (var description in transdesc) { //English is the Default Language and will be used as the Description on the Categories Table if (description.Language == "English") { ResourceCategory Category = new ResourceCategory() { CategoryID = CategoryID, CategoryDescription = description.TranslatedCategoryDescription, CategoryOrder = NewOrder, ParentID = (Guid)parentID }; Exigo.AddResourceCategory(Category); } //Adds an entry for each language translation provided in the TranslatedCategoryItems table ResourceTranslatedCategoryItem TCategory = new ResourceTranslatedCategoryItem() { TranslatedCategoryID = Guid.NewGuid(), CategoryID = CategoryID, Language = description.Language, TranslatedCategoryDescription = description.TranslatedCategoryDescription }; Exigo.AddCategoryTranslation(TCategory); } return(new JsonNetResult(new { success = true })); } catch (Exception ex) { return(new JsonNetResult(new { success = false, message = ex.Message })); } }