public HttpResponseMessage PostCategory(Category model)
        {
            if (model == null || model.Name == null || model.Name.Length < 6)
            {
                var errResponse = this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "The name of the Category should be at least 6 characters");
                return errResponse;
            }

            var entity = this.categoryRepository.Add(model);

            var response =
                Request.CreateResponse(HttpStatusCode.Created, entity);

            response.Headers.Location = new Uri(Url.Link("DefaultApi",
                new { id = entity.Id }));
            return response;
        }
        public HttpResponseMessage PutCategory(int id, Category item)
        {
            if (id<=0)
            {
                var errorResponse = this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "ID must be positive");
                return errorResponse;
            }
            if (item == null || item.Name == null)
            {
                var errorResponse = this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Object is null");
                return errorResponse;
            }
            var entity = this.categoryRepository.Update(id, item);
            var response = Request.CreateResponse(HttpStatusCode.OK, entity);
            response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = entity.Id }));

            return response;
        }
        public HttpResponseMessage PostCategory(Category item)
        {
            if (item == null || item.Name == null)
            {
                var errorResponse = this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Object is null");
                return errorResponse;
            }
            var entity = this.categoryRepository.Add(item);
            var response = Request.CreateResponse(HttpStatusCode.Created, entity);
            response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = entity.Id }));

            return response;
        }