public ActionResult Edit(EditModel model, string categId)
        {
            int categoryId = Convert.ToInt32(categId);

            if (!ModelState.IsValid)
            {
                model.Categories =
                    categoriesRepository.Categories.Select(
                        x => new Categories {
                    Id = x.CategoryId, Name = x.CategoryName
                }).ToList();
                return(View(model));
            }

            Lot prod = lotsRepository.Lots.FirstOrDefault(p => p.LotID == model.LotID);

            if (prod == null)
            {
                return(View(model));
            }

            prod.Name        = model.Name;
            prod.Description = model.Description;

            var cat = categoriesRepository.Categories.FirstOrDefault(x => x.CategoryId == categoryId);

            if (cat == null)
            {
                ModelState.AddModelError("", Resources.LotsControllerUnknownCategory);
                return(View(model));
            }
            lotsRepository.Edit(prod, cat);
            return(RedirectToAction("Lot", "Lots", new { lotId = model.LotID }));
        }