public ActionResult Index(CheckoutShippingViewModel model) { if (ModelState.IsValid) { model.quote = GetQuote(); Mapper.CreateMap <CheckoutShippingViewModel, Address>(); if (model.quote.Address == null) { AddressService.CreateAddress(model.quote.QuoteID, Mapper.Map <Address>(model)); } else { Address UpdatedAddress = Mapper.Map <Address>(model); UpdatedAddress.AddressID = model.quote.Address.AddressID; AddressService.UpdateAddress(UpdatedAddress); } Quote quote = GetQuote(); quote.ShippingCharge = quote.CalculateShipping(); QuoteService.UpdateQuote(quote); string URL = PayPal.ConfirmSale(GetQuote()); return(Redirect(URL)); } return(Index()); }