public ActionResult Sell(SellModel model, string categ)
        {
            //var errors = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => new { x.Key, x.Value.Errors }).ToArray();
            if (!ModelState.IsValid)
            {
                model.Categories =
                    categoriesRepository.Categories.Select(
                        x => new Categories {
                    Id = x.CategoryId, Name = x.CategoryName
                });

                return(View(model));
            }
            if (categ == null)
            {
                ModelState.AddModelError("", Resources.SellerControllerCategory);
                return(View(model));
            }
            Lot lot = new Lot
            {
                Images       = new List <Image>(),
                CurrentPrice = model.MinPrice,
                Name         = model.Name,
                MinPrice     = model.MinPrice,
                Description  = model.Description,
                EndTime      = model.EndTime,
                IsCompleted  = false
            };
            int i = 0;

            foreach (var img in model.Files)
            {
                if (img != null)
                {
                    lot.Images.Add(new Image
                    {
                        ImageMimeType = img.ContentType,
                        ImageData     = new byte[img.ContentLength],
                    });
                    img.InputStream.Read(lot.Images[i++].ImageData, 0, img.ContentLength);
                }
            }
            var categoryId = Convert.ToInt32(categ);
            var cat        = categoriesRepository.Categories.FirstOrDefault(x => x.CategoryId == categoryId);

            lot.Category = cat;
            lotsRepository.Add(lot);
            return(RedirectToAction("Lot", "Lots", new { lotId = lot.LotID }));
        }