public Task<ResourceResponse<Document>> UpdateProductAsync(Product product)
        {
            var doc = Client.CreateDocumentQuery<Document>(Collection.DocumentsLink)
                .Where(d => d.Id == product.Id)
                .AsEnumerable() // why the heck do we need to do this??
                .FirstOrDefault();

            return Client.ReplaceDocumentAsync(doc.SelfLink, product);
        }
 public async Task<HttpResponseMessage> CreateAsync(Product model)
 {
     await _productRepository.CreateProduct(model);
     var response = Request.CreateResponse(HttpStatusCode.Created);
     var uri = Url.Link(RetrieveProductRoute, new {id = model.Id});
     response.Headers.Location = new Uri(uri);
     return response;
 }
 public Task<ResourceResponse<Document>> CreateProduct(Product product)
 {
     return Client.CreateDocumentAsync(Collection.DocumentsLink, product);
 }
 public async Task<HttpResponseMessage> LoadAsync(Product model)
 {
     var existing = await _productRepository.GetProductsAsync();
     if (existing.Count < 30)
     {
         for (var i = 0; i < 30; i++)
         {
             var product = new Product(Company.Name())
             {
                 Archived = false,
                 Description = Lorem.Sentence(),
                 QuantityAvailable = RandomNumber.Next(1, 1000)
             };
             await _productRepository.CreateProduct(product);
         }
     }
     var response = Request.CreateResponse(HttpStatusCode.OK);
     return response;
 }