public ActionResult Index()
        {
            var deliveryMatrix = new DeliveryMatrixViewModel();
            deliveryMatrix.Columns = new List<List<DeliveryInternationalSettingViewModel>>();

            int x = 0;
            foreach (var countryTo in _countryRepository.Table)
            {
                int y = 0;
                var newColumn = new List<DeliveryInternationalSettingViewModel>();
                foreach (var countryFrom in _countryRepository.Table)
                {
                    var setting = new DeliveryInternationalSettingViewModel();
                    // If it won't be a delivery from a country to the same country
                    // then populate the matrix with the real data.
                    if (x != y)
                    {
                        var record = _deliveryInternationalSettingRepository.Table
                            .Where(s => (s.CountryFrom.Id == countryFrom.Id) && (s.CountryTo.Id == countryTo.Id))
                            .FirstOrDefault();
                        if (record == null)
                        {
                            record = new DeliveryInternationalSettingRecord();
                            record.CountryFrom = countryFrom;
                            record.CountryTo = countryTo;
                            record.IsActive = false;
                            _deliveryInternationalSettingRepository.Create(record);
                        }
                        setting.Id = record.Id;
                        setting.CountryFromId = record.CountryFrom.Id;
                        setting.CountryFromName = record.CountryFrom.Name;
                        setting.CountryToId = record.CountryTo.Id;
                        setting.CountryToName = record.CountryTo.Name;
                        setting.DeliveryPrice = record.DeliveryPrice;
                        setting.IsActive = record.IsActive;
                    }
                    // It's a delivery from a country to the same country.
                    // just pass the empty setting to the view.
                    else
                    {
                        setting.CountryFromName = countryFrom.Name;
                        setting.CountryToName = countryTo.Name;
                    }
                    newColumn.Add(setting);
                    y++;
                }
                deliveryMatrix.Columns.Add(newColumn);
                x++;
            }

            return View(deliveryMatrix);
        }
        public ActionResult Edit(DeliveryMatrixViewModel viewModel)
        {
            int x = 0;
            foreach(var column in viewModel.Columns)
            {
                int y = 0;
                foreach(var newSetting in column)
                {
                    // Dont save delivery settings from a country to the same country
                    if (x != y)
                    {
                        var record = _deliveryInternationalSettingRepository.Table
                                .Where(s => (s.CountryFrom.Id == newSetting.CountryFromId)
                                    && (s.CountryTo.Id == newSetting.CountryToId))
                                .First();

                        record.CountryFrom = _countryRepository.Get(newSetting.CountryFromId);
                        record.CountryTo = _countryRepository.Get(newSetting.CountryToId);
                        record.DeliveryPrice = newSetting.DeliveryPrice;
                        record.IsActive = newSetting.IsActive;
                        _deliveryInternationalSettingRepository.Update(record);
                    }
                    y++;
                }
                x++;
            }

            _orchardServices.Notifier.Information(T("Settings have been changed!"));
            return RedirectToAction("Index");
        }