public void AddCategory(CategoryViewModel category) { category.Id = category.Id == Guid.Empty ? Guid.NewGuid() : category.Id; category.CreateDate = category.CreateDate == DateTime.MinValue ? DateTime.Now : category.CreateDate; category.Name = category.Name.IsEmpty() ? "Новая категория" : category.Name; category.Order = category.Order == 0 ? (_storageDb.GetCategoryChildrenCount(category.ParentId) + 1) : category.Order; _storageDb.AddCategory(category); }