public async Task <IActionResult> CreateCategory([FromBody] CategoryBundleAddDto model)
        {
            if (model == null)
            {
                return(BadRequest("model is null"));
            }
            var category = await _service.AddCategory(model);

            return(CreatedAtRoute("GetCategoryBundle", new { id = category.CategoryId }, category));
        }
        public async Task <CategoryBundleDto> AddCategory(CategoryBundleAddDto model)
        {
            var modelToBundle = _mapper.Map <CategoryBundle>(model);

            var category = await _unitOfWork.CategoryBundle.GetById(modelToBundle.CategoryId);

            if (category != null)
            {
                throw new HttpException(400, "Category Exists");
            }

            await _unitOfWork.CategoryBundle.Add(category);

            await _unitOfWork.Commit();

            var mapped = _mapper.Map <CategoryBundleDto>(category); // CreatedAtRoute için

            return(mapped);
        }