public ActionResult EditCountry(CountryViewModel viewModel)
        {
            bool step1;
            bool step2;
            bool step3;

            var record = _countryRepository.Get(viewModel.Id);
            record.Name = viewModel.Name;
            record.Code = viewModel.Code;
            _countryRepository.Update(record);
            step1 = true;

            foreach (var lnk in _linkCountryCultureRepository.Table.Where(l => l.CountryRecord.Id == viewModel.Id))
            {
                _linkCountryCultureRepository.Delete(lnk);
            }
            step2 = true;

            if (viewModel.SelectedCultures != null)
            {
                foreach (var cultureId in viewModel.SelectedCultures)
                {
                    var linkCountryCulture = new LinkCountryCultureRecord();
                    linkCountryCulture.CountryRecord = record;
                    linkCountryCulture.CultureRecord = _cultureRepository.Get(cultureId);
                    _linkCountryCultureRepository.Create(linkCountryCulture);
                }
            }
            step3 = true;

            _orchardServices.Notifier.Information(T("Record has been changed!"));
            return RedirectToAction("Index");
        }
        public ActionResult AddCountry(CountryViewModel viewModel)
        {
            bool step1 = false;
            bool step2 = false;

            var record = new CountryRecord()
            {
                Code = viewModel.Code,
                Name = viewModel.Name,
            };
            _countryRepository.Create(record);
            step1 = true;

            if (viewModel.SelectedCultures != null)
            {
                foreach (var cultureId in viewModel.SelectedCultures)
                {
                    var linkCountryCulture = new LinkCountryCultureRecord();
                    linkCountryCulture.CountryRecord = record;
                    linkCountryCulture.CultureRecord = _cultureRepository.Get(cultureId);
                    _linkCountryCultureRepository.Create(linkCountryCulture);
                }
            }
            step2 = true;

            _orchardServices.Notifier.Information(T("Record has been added!"));
            return RedirectToAction("Index");
        }