public string SaveOrUpdate(CategoryDto item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item", "Category item cannot be null.");
            }

            if (item.Name == null)
            {
                throw new ArgumentNullException("item.Name", "Category name cannot be null.");
            }

            if (item.Name == string.Empty)
            {
                throw new ArgumentException("Category name cannot be empty", "item.Name");
            }

            Category category;
            string   oldCategoryName = null;

            if (item.Id > 0)
            {
                category        = this.Session.Load <Category>(item.Id);
                oldCategoryName = category.Name;

                if (category == null)
                {
                    throw new DexterCategoryNotFoundException(item.Id);
                }
            }
            else
            {
                category = new Category();
            }

            item.MapPropertiesToInstance(category);
            category.ParentId = category.ParentId;

            if (string.IsNullOrEmpty(category.Slug))
            {
                category.Slug = SlugHelper.GenerateSlug(category.Name, category.Id, this.GetCategoryBySlug);
            }

            this.Session.Store(category);

            UpdateCategoryIndex.UpdateCategoryIndexes(this.store, this.Session, category, oldCategoryName);

            return(category.Id);
        }