// function almost duplicated in ItemViewModel
        private void RaisePropertyValueDeleteInteractionRequest(object originalItemObject)
        {
            var originalItem = (PropertyAndPropertyValueBase)originalItemObject;
            var item         = originalItem.Value as CategoryPropertyValue;

            if (item != null)
            {
                InnerItem.CategoryPropertyValues.Remove(item);
                if (originalItem.Property == null)
                {
                    PropertiesAndValues.Remove(originalItem);
                }
                else
                {
                    originalItem.Value = null;
                }

                OnViewModelCollectionChangedUI(null, null);
            }
            else if (originalItem.IsMultiValue && originalItem.Values != null)
            {
                foreach (var value in originalItem.Values)
                {
                    var itemToRemove = InnerItem.CategoryPropertyValues.First(y => y.KeyValue == value.KeyValue);
                    InnerItem.CategoryPropertyValues.Remove(itemToRemove);
                }

                originalItem.Values = null;
                OnViewModelCollectionChangedUI(null, null);
            }
        }
        // function almost duplicated in ItemViewModel
        protected override bool IsValidForSave()
        {
            var result = InnerItem.Validate();

            // Code should be unique in scope of catalog
            var isCodeValid = true;

            if (InnerItem.Code != OriginalItem.Code)
            {
                var count = ItemRepository.Categories
                            .Where(x =>
                                   x.CatalogId == InnerItem.CatalogId && x.Code == InnerItem.Code && x.CategoryId != InnerItem.CategoryId)
                            .Count();

                if (count > 0)
                {
                    InnerItem.SetError("Code", "A category with this Code already exists in this catalog".Localize(), true);
                    SelectedTabIndex = TabIndexOverview;
                    isCodeValid      = false;
                }
            }

            var isPropertyValuesValid = PropertiesAndValues.All(x => x.IsValid);

            if (!isPropertyValuesValid && isCodeValid)
            {
                SelectedTabIndex = TabIndexProperties;
                var val = PropertiesAndValues.First(x => !x.IsValid);
                if (!string.IsNullOrEmpty(val.Locale) && val.Locale != FilterLanguage)
                {
                    RaisePropertiesLocalesFilter(val.Locale);
                }
            }

            var seoIsValid = true;

            if (SeoStepViewModel != null)
            {
                seoIsValid = SeoStepViewModel.IsValid;
                if (!seoIsValid)
                {
                    SelectedTabIndex = TabIndexSeo;
                }
            }

            return(result && isPropertyValuesValid && isCodeValid && seoIsValid);
        }