public ProductReservationResponse ReserveProduct(ReserveProductRequest productReservationRequest)
 {
     ProductReservationResponse reserveProductResponse = new ProductReservationResponse();
     try
     {
         Product product = _productRepository.FindBy(Guid.Parse(productReservationRequest.ProductId));
         if (product != null)
         {
             ProductReservation productReservation = null;
             if (product.CanReserveProduct(productReservationRequest.ProductQuantity))
             {
                 productReservation = product.Reserve(productReservationRequest.ProductQuantity);
                 _productRepository.Save(product);
                 reserveProductResponse.ProductId = productReservation.Product.ID.ToString();
                 reserveProductResponse.Expiration = productReservation.Expiry;
                 reserveProductResponse.ProductName = productReservation.Product.Name;
                 reserveProductResponse.ProductQuantity = productReservation.Quantity;
                 reserveProductResponse.ReservationId = productReservation.Id.ToString();
             }
             else
             {
                 int availableAllocation = product.Available();
                 reserveProductResponse.Exception = new LimitedAvailabilityException(string.Concat("There are only ", availableAllocation,
                     " pieces of this product left."));
             }
         }
         else
         {
             throw new ResourceNotFoundException(string.Concat("No product with id ", productReservationRequest.ProductId, ", was found."));
         }
     }
     catch (Exception ex)
     {
         reserveProductResponse.Exception = ex;
     }
     return reserveProductResponse;
 }
 public HttpResponseMessage Post(ReserveProductRequest reserveProductRequest)
 {
     ServiceResponseBase response = _productService.ReserveProduct(reserveProductRequest);
     return Request.BuildResponse(response);
 }