public IHttpActionResult PutVoucher(int id, VoucherModel voucher)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != voucher.Id)
            {
                return(BadRequest());
            }

            OfferModel offer = offerService.GetById((int)voucher.OfferId);
            UserModel  buyer = usersService.GetById((int)voucher.BuyerId);

            if (offer == null || buyer == null)
            {
                return(NotFound());
            }

            if (buyer.UserRole != UserRole.ROLE_CUSTOMER)
            {
                return(BadRequest("User's role must be ROLE_CUSTOMER"));
            }

            voucher.Offer = offer;
            voucher.User  = buyer;
            VoucherModel updatedVoucher = voucherService.PutVoucher(id, voucher);

            if (updatedVoucher == null)
            {
                return(NotFound());
            }

            return(Ok(updatedVoucher));
        }