public ActionResult EditSmiley(int SmileyID)
        {
            Smiley smiley = _smileyRepository.Get(SmileyID);

            SmileyViewModel model = new SmileyViewModel()
            {
                Code = smiley.Code,
                ImageURL = smiley.ImageURL,
                SmileyID = smiley.SmileyID,
                Title = smiley.Title
            };

            return View(model);
        }
        public ActionResult EditSmiley(SmileyViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (_smileyRepository.First(item => item.Code.ToLower() == model.Code.ToLower()) != null)
                    ModelState.AddModelError("Code", "A smiley with this code already exists.");
            }

            if (IsModelValidAndPersistErrors())
            {
                Smiley smiley = new Smiley()
                {
                    Code = model.Code,
                    ImageURL = model.ImageURL,
                    SmileyID = model.SmileyID,
                    Title = model.Title
                };
                _smileyRepository.Update(smiley);
                SetSuccess("Smiley saved");
                return RedirectToAction("Smilies");
            }

            return RedirectToSelf();
        }