// GET: Admin/VehicleItem/Create
        public async Task <ActionResult> Create()
        {
            var model = new VehicleItemModel
            {
                Items    = await db.Items.ToListAsync(),
                Vehicles = await db.Vehicles.ToListAsync(),
            };

            return(View(model));
        }
        //in the below convert method I take a vehicle item and conert it in to a vehicle item model using the application
        //db context to fill the collections and use the vehicle item thats sent in to fill the item id and vehicle id properties
        //and then return the model
        public static async Task <VehicleItemModel> Convert(this VehicleItem vehicleItem, ApplicationDbContext db,
                                                            bool addListData = true)
        {
            var model = new VehicleItemModel
            {
                ItemId    = vehicleItem.ItemId,
                VehicleId = vehicleItem.VehicleId,
                Items     = addListData ? await db.Items.ToListAsync() : null,
                Vehicles  = addListData ? await db.Vehicles.ToListAsync() : null,
                ItemTitle = (await db.Items.FirstOrDefaultAsync(i =>
                                                                i.Id.Equals(vehicleItem.ItemId))).Title,
                VehicleTitle = (await db.Vehicles.FirstOrDefaultAsync(v =>
                                                                      v.Id.Equals(vehicleItem.VehicleId))).Title
            };

            return(model);
        }