public ActionResult Update(LotViewModel lot)
        {
            if (UserViewModel == null)
                return new HttpStatusCodeResult(401);
            if ((UserViewModel.Id != lot.CreatedByUserId) &&
                (!_customAuthentication.CheckUserInRoles(UserViewModel.ToUserEntity(), "Admin,Moderator")))
                return new HttpStatusCodeResult(403);
            var oldLot = _lotService.GetLotEntity(lot.Id);
            ViewBag.HasImage = oldLot.LotPicture != null;
            lot.CreatedByUserId = oldLot.CreatedByUserId;
            if (ModelState.IsValid)
            {
                if (lot.EndDate < DateTime.Now)
                { 
                        ModelState.AddModelError(string.Empty, "End Date cannot come before Now");
                        return View(lot);
                }
                    if (lot.MinimalBid < 0.01m)
                    {
                        ModelState.AddModelError(string.Empty, "Starting bid can't be less than 0.1");
                        return View(lot);
                    }
                    if ((lot.BuyOutBid != null) && (lot.BuyOutBid.Value <= lot.MinimalBid))
                    {
                        ModelState.AddModelError(string.Empty, "Buyout bid can't be less than or equal to starting bid!");
                        return View(lot);
                    }
                    WebImage wi = WebImage.GetImageFromRequest();
                    var r = wi;
                    if (wi != null)
                    {
                        wi.Resize(300, 300, true, true);
                        lot.LotPicture = wi.GetBytes();
                        wi.Resize(100, 100, true, true);
                        lot.LotPicturePreview = wi.GetBytes();
                    }
                if ((wi == null) && (!lot.DeletePicture))
                {

                    lot.LotPicture = oldLot.LotPicture;
                    lot.LotPicturePreview = oldLot.LotPicturePreview;
                }

                _lotService.UpdateLot(lot.ToLotEntity());
                return RedirectToAction("Details", new {id = lot.Id});
            }
            return View(lot);
        }
        public ActionResult Create(LotViewModel lot)
        {

            if (ModelState.IsValid)
            {
                if (lot.EndDate < DateTime.Now)
                {
                    ModelState.AddModelError(string.Empty, "End Date cannot come before Now");
                    return View(lot);
                }
                if (lot.MinimalBid < 0.01m)
                {
                    ModelState.AddModelError(string.Empty, "Starting bid can't be less than 0.1");
                    return View(lot);
                }
                if ((lot.BuyOutBid != null) && (lot.BuyOutBid.Value <= lot.MinimalBid))
                {
                    ModelState.AddModelError(string.Empty, "Buyout bid can't be less than or equal to starting bid!");
                    return View(lot);
                }
                lot.CreatedByUserId = UserViewModel.Id;
                WebImage wi = WebImage.GetImageFromRequest();
                if (wi != null)
                {
                    wi.Resize(300, 300, true, true);
                    lot.LotPicture = wi.GetBytes();
                    wi.Resize(100, 100, true, true);
                    lot.LotPicturePreview = wi.GetBytes();
                }
                _lotService.CreateLot(lot.ToLotEntity());
                return RedirectToAction("Index");
            }
            return View(lot);

        }