public async Task<IHttpActionResult> GetBookCategory(int id)
        {
            if (id == 0) return BadRequest("id must be higher than 0");
            var category = await _repository.GetById(id);
            var categoryModel = new BookCategoryModel();

            return Ok(categoryModel.InjectFrom(category));
        }
        public async Task<IHttpActionResult> SaveBookCategory(BookCategoryModel categoryModel)
        {
            if (ModelState.IsValid)
            {
                var entity = new BookCategory();
                entity.InjectFrom(categoryModel);

                return Ok(await _repository.Save(entity));
            }
            var errors = ModelState.Values.SelectMany(x => x.Errors);
            return BadRequest(Helper.GenerateModelStateError(errors));
        }
 public Task<int> SaveBookCategory(BookCategoryModel model)
 {
     return Save<int, BookCategoryModel>(model);
 }
        public async Task<ActionResult> AddCategory(BookCategoryModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _categoryProvider.SaveBookCategory(model);
                var vm = await LoadManageViewModel();

                vm.HasChanges = true;
                vm.Success = result > 0;

                return View("Index", vm);
            }

            return View("Index", await LoadManageViewModel());
        }