public ActionResult Configure()
        {
            var model = new ConfigurationModel();

            if (AppDomain.CurrentDomain.IsFullyTrusted)
            {
                //full trust
                System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                string googleEnvironment = config.AppSettings.Settings["GoogleEnvironment"].Value;
                model.UseSandbox = googleEnvironment == "Sandbox";
                model.GoogleVendorId = config.AppSettings.Settings["GoogleMerchantID"].Value;
                model.GoogleMerchantKey = config.AppSettings.Settings["GoogleMerchantKey"].Value;
                model.AuthenticateCallback = Convert.ToBoolean(config.AppSettings.Settings["GoogleAuthenticateCallback"].Value);
                model.PassEditLink = _settingService.GetSettingByKey<bool>("GoogleCheckout.PassEditLink");
            }
            else
            {
                //medium trust (can't edit)
                ModelState.AddModelError("", "Configuring Google Checkout is not allowed in medium trust. Manually update web.config file.");
            }
            return View("Nas.Plugin.Payments.GoogleCheckout.Views.PaymentGoogleCheckout.Configure", model);
        }
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
                return Configure();

            try
            {
                System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");

                if (model.UseSandbox)
                    config.AppSettings.Settings["GoogleEnvironment"].Value = "Sandbox";
                else
                    config.AppSettings.Settings["GoogleEnvironment"].Value = "Production";
                config.AppSettings.Settings["GoogleMerchantId"].Value = model.GoogleVendorId;
                config.AppSettings.Settings["GoogleMerchantKey"].Value = model.GoogleMerchantKey;
                config.AppSettings.Settings["GoogleAuthenticateCallback"].Value = model.AuthenticateCallback.ToString();
                _settingService.SetSetting("GoogleCheckout.PassEditLink", model.PassEditLink);
                config.Save(ConfigurationSaveMode.Modified);
            }
            catch (Exception exc)
            {
                ModelState.AddModelError("", exc.Message);
            }
            return View("Nas.Plugin.Payments.GoogleCheckout.Views.PaymentGoogleCheckout.Configure", model);
        }