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      = ExigoDAL.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
                        };
                        ExigoDAL.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
                    };
                    ExigoDAL.AddCategoryTranslation(TCategory);
                }

                return(new JsonNetResult(new
                {
                    success = true
                }));
            }
            catch (Exception ex)
            {
                return(new JsonNetResult(new
                {
                    success = false,
                    message = ex.Message
                }));
            }
        }
        public JsonNetResult EditCategory(List <TranslatedCategory> items, Guid categoryID, Guid?parentID)
        {
            try
            {
                foreach (var item in items.Where(i => !i.Language.IsNullOrEmpty()))
                {
                    if (item.Language == "English")
                    {
                        //Update the Resource
                        var resourceCategory = ExigoDAL.GetResourceCategories(new GetResourceCategoriesRequest()
                        {
                            CategoryID = categoryID
                        }).FirstOrDefault();
                        resourceCategory.CategoryDescription = item.TranslatedCategoryDescription;
                        resourceCategory.ParentID            = parentID ?? Guid.Empty;
                        ExigoDAL.ModifyResourceCategory(resourceCategory);
                    }
                    //Update the Translations
                    var translatedCategory = ExigoDAL.GetCategoryTranslations(new GetTranslatedCategoryRequest()
                    {
                        Language = item.Language, CategoryID = categoryID
                    }).FirstOrDefault();
                    if (translatedCategory != null)
                    {
                        translatedCategory.TranslatedCategoryDescription = item.TranslatedCategoryDescription;
                        ExigoDAL.ModifyResourceTranslationDescription(translatedCategory);
                    }
                    else
                    {
                        ResourceTranslatedCategoryItem TCategory = new ResourceTranslatedCategoryItem()
                        {
                            TranslatedCategoryID          = Guid.NewGuid(),
                            CategoryID                    = categoryID,
                            Language                      = item.Language,
                            TranslatedCategoryDescription = item.TranslatedCategoryDescription
                        };
                        ExigoDAL.AddCategoryTranslation(TCategory);
                    }
                }

                return(new JsonNetResult(new
                {
                    success = true
                }));
            }
            catch (Exception ex)
            {
                return(new JsonNetResult(new
                {
                    success = false,
                    message = ex.Message
                }));
            }
        }