public ActionResult Create()
        {
            Uri previousPage = Request.UrlReferrer;

            var model = new CultureViewModel
            {
                PreviousUrl = (!previousPage.LocalPath.Contains("Culture")) ? previousPage : null
            };
            bool isDefaultExist = _cultureService.GetAll().Any(c => c.Default);
            model.IsAnyAlreayDefault = isDefaultExist;
            return View(model);
        }
        public ActionResult Create(CultureViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (_cultureService.GetCultureByName(model.Name) == null)
                {
                    var culture = new BOCulture();
                    bool isDefaultExist = _cultureService.GetAll().Any(c => c.Default);

                    Mapper.Map<CultureViewModel, BOCulture>(model, culture);

                    try
                    {
                        var info = new CultureInfo(model.Name);
                        culture.DisplayName = info.DisplayName;
                        culture.EnglishName = info.EnglishName;
                        culture.Available = true;
                        culture.Default = !isDefaultExist;
                    }
                    catch (CultureNotFoundException)
                    {
                        ModelState.AddModelError("Message", "Culture code is not valid.");
                        return View(model);
                    }

                    _cultureService.Save(culture);

                    if (model.PreviousUrl != null)
                        return Redirect(model.PreviousUrl.AbsoluteUri);

                    return RedirectToAction("Index");
                }

                ModelState.AddModelError("Message", "Culture with this name already exists.");
            }

            return View(model);
        }
        public ActionResult Edit(CultureViewModel model)
        {
            if (ModelState.IsValid)
            {
                BOCulture culture = _cultureService.GetCultureById(model.ID);
                Mapper.Map<CultureViewModel, BOCulture>(model, culture);

                _cultureService.Save(culture);

                return RedirectToAction("Index");
            }

            return View(model);
        }