public ActionResult Create(PalletGroupCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            using (var db = new ApplicationDbContext())
            {
                List<PalletDescriptor> palletDescriptorsToAdd = new List<PalletDescriptor>();
                foreach (var id in model.PalletDescriptorID)
                {
                    palletDescriptorsToAdd.Add(db.PalletDescriptors.Single(p => p.ID == id));
                }

                PalletGroup palletGroupToCreate = new PalletGroup
                {
                    Name = model.Name,
                    IsDeleted = false,
                    DateAdded = DateTime.Now,
                    Items = new List<Item>(),
                    PalletDescriptors = palletDescriptorsToAdd
                };

                db.PalletGroups.Add(palletGroupToCreate);
                db.SaveChanges();

                return RedirectToAction("Index");
            }
        }
        public ActionResult Create()
        {
            using (var db = new ApplicationDbContext())
            {
                var model = new PalletGroupCreateViewModel();
                var palletDescriptors = db.PalletDescriptors.Select(p => new
                {
                    ID = p.ID,
                    Name = p.Name
                }).ToList();
                model.PalletDescriptors = new MultiSelectList(palletDescriptors, "ID", "Name");

                model.PalletDescriptorID = new int[0];
                return View(model);
            }
        }