protected override async Task Handle(Command request, CancellationToken cancellationToken)
            {
                SpendCategory category = await _categoryRepository.GetByName(request?.Category);

                if (category is null)
                {
                    category      = new SpendCategory();
                    category.Name = request?.Category;

                    await _categoryRepository.Add(category);
                }
                await _repository.Add(MapWasteProductViewToModel(request, category.Id));
            }
            protected override async Task Handle(Command request, CancellationToken cancellationToken)
            {
                var foodProduct = await _repository.Get(request.Id);

                if (foodProduct is null)
                {
                    throw new Exception("Food product doesn't exist!");
                }

                SpendCategory category = await _categoryRepository.GetByName(request?.Category?.Name);

                if (category is null)
                {
                    category = new SpendCategory {
                        Name = request?.Category?.Name
                    };

                    await _categoryRepository.Add(category);
                }

                MapWasteProductViewToModel(foodProduct, request, category.Id);
                await _repository.Update(foodProduct);
            }
        public ActionResult Edit(SpendCategory model)
        {
            SpendService.Instance(UserSid).SpendCategoryEdit(model);

            return(Json(new { }));
        }
        public ActionResult New()
        {
            var model = new SpendCategory();

            return(View(model));
        }