public IHttpActionResult Put(int id, Product product)
        {
            product.Id = id;
            if (!products.Update(product))
            {
                return NotFound();
            }

            return Ok(product);
        }
        public HttpResponseMessage Post(Product product)
        {
            var addedProduct = products.Add(product);

            var response = Request.CreateResponse<Product>(HttpStatusCode.Created, product);

            string uri = Url.Link("DefaultApi", new { id = product.Id });
            response.Headers.Location = new Uri(uri);

            return response;
        }
        public Product Add(Product product)
        {
            if (product == null)
            {
                throw new ArgumentNullException("product");
            }

            this.maxId++;
            product.Id = maxId;

            this.products.Add(product);

            return product;
        }
        public bool Update(Product product)
        {
            if (product == null)
            {
                throw new ArgumentNullException("product");
            }
            
            var storedProduct = this.products.FirstOrDefault(P => P.Id == product.Id);

            if (storedProduct == null)
            {
                return false;
            }

            storedProduct.Name = product.Name;
            storedProduct.Category = product.Category;
            storedProduct.Price = product.Price;

            return true;
        }