public HttpResponseMessage ProcessOrder(int id, Order order)
        {
            if (order == null || id != order.Id)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, Resources.InvalidOrder);
            }

            if (ModelState.IsValid)
            {
                // TODO: add business logic validation (check stock, approve transaction, etc)
                // for instance, validate the transaction before performing the purchase
                var result = order.PaymentMethod.CardNumber != "22222" ? "APPROVED" : string.Format(CultureInfo.CurrentCulture, "Invalid Payment Method. Reason: {0}", "DECLINED_CONTACT_YOUR_BANK");

                if (result == "APPROVED")
                {
                    // TODO: Process the order
                    _orderRepository.Delete(order.Id);
                    return Request.CreateResponse();
                }
                else
                {
                    ModelState.AddModelError("order.PaymentMethod", result);
                }
            }

            // Only get here if there are ModelState errors
            return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
        }
        public HttpResponseMessage CreateOrder(Order order)
        {
            if (order == null)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, Resources.InvalidOrder);
            }

            if (ModelState.IsValid)
            {
                order = _orderRepository.Create(order);
                var response = Request.CreateResponse(HttpStatusCode.Created, order.Id);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = order.Id }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }