public ActionResult CreateTrip(ViewCreateTripModel model) { var user = (ViewUser)Session["user"]; model.CreatedByUserId = user.UserId; var filePath = Server.MapPath("~/Files/" + "Create_Trip_File.xml"); model.TripModels = GetProductFromXmalFile(filePath).ToList(); bool result = _iInventoryManager.CreateTrip(model); if (result) { var xmlData = XDocument.Load(filePath); xmlData.Root?.Elements().Remove(); xmlData.Save(filePath); } return(View()); }