public async Task <IActionResult> RemoveLndSeedPost(string serviceName, string cryptoCode)
        {
            var service = GetService(serviceName, cryptoCode);

            if (service == null)
            {
                return(NotFound());
            }

            var model = LndSeedBackupViewModel.Parse(service.ConnectionString.CookieFilePath);

            if (!model.IsWalletUnlockPresent)
            {
                TempData[WellKnownTempData.ErrorMessage] = $"File with wallet password and seed info not present";
                return(RedirectToAction(nameof(Services)));
            }

            if (string.IsNullOrEmpty(model.Seed))
            {
                TempData[WellKnownTempData.ErrorMessage] = $"Seed information was already removed";
                return(RedirectToAction(nameof(Services)));
            }

            if (await model.RemoveSeedAndWrite(service.ConnectionString.CookieFilePath))
            {
                TempData[WellKnownTempData.SuccessMessage] = $"Seed successfully removed";
                return(RedirectToAction(nameof(Service), new { serviceName, cryptoCode }));
            }
            else
            {
                TempData[WellKnownTempData.ErrorMessage] = $"Seed removal failed";
                return(RedirectToAction(nameof(Services)));
            }
        }
        public async Task <IActionResult> Service(string serviceName, string cryptoCode, bool showQR = false, uint?nonce = null)
        {
            var service = GetService(serviceName, cryptoCode);

            if (service == null)
            {
                return(NotFound());
            }
            if (!string.IsNullOrEmpty(cryptoCode) && !_dashBoard.IsFullySynched(cryptoCode, out _) && service.Type != ExternalServiceTypes.RPC)
            {
                TempData[WellKnownTempData.ErrorMessage] = $"{cryptoCode} is not fully synched";
                return(RedirectToAction(nameof(Services)));
            }
            try
            {
                if (service.Type == ExternalServiceTypes.P2P)
                {
                    return(View("P2PService", new LightningWalletServices()
                    {
                        ShowQR = showQR,
                        WalletName = service.ServiceName,
                        ServiceLink = service.ConnectionString.Server.AbsoluteUri.WithoutEndingSlash()
                    }));
                }
                if (service.Type == ExternalServiceTypes.LNDSeedBackup)
                {
                    var model = LndSeedBackupViewModel.Parse(service.ConnectionString.CookieFilePath);
                    if (!model.IsWalletUnlockPresent)
                    {
                        TempData.SetStatusMessageModel(new StatusMessageModel()
                        {
                            Severity = StatusMessageModel.StatusSeverity.Warning,
                            Html     = "Your LND does not seem to allow seed backup.<br />" +
                                       "It's recommended, but not required, that you migrate as instructed by <a href=\"https://blog.btcpayserver.org/btcpay-lnd-migration\">our migration blog post</a>.<br />" +
                                       "You will need to close all of your channels, and migrate your funds as <a href=\"https://blog.btcpayserver.org/btcpay-lnd-migration\">we documented</a>."
                        });
                    }
                    return(View("LndSeedBackup", model));
                }
                if (service.Type == ExternalServiceTypes.RPC)
                {
                    return(View("RPCService", new LightningWalletServices()
                    {
                        ShowQR = showQR,
                        WalletName = service.ServiceName,
                        ServiceLink = service.ConnectionString.Server.AbsoluteUri.WithoutEndingSlash()
                    }));
                }
                var connectionString = await service.ConnectionString.Expand(this.Request.GetAbsoluteUriNoPathBase(), service.Type, _Options.NetworkType);

                switch (service.Type)
                {
                case ExternalServiceTypes.Charge:
                    return(LightningChargeServices(service, connectionString, showQR));

                case ExternalServiceTypes.RTL:
                case ExternalServiceTypes.ThunderHub:
                case ExternalServiceTypes.Spark:
                    if (connectionString.AccessKey == null)
                    {
                        TempData[WellKnownTempData.ErrorMessage] = $"The access key of the service is not set";
                        return(RedirectToAction(nameof(Services)));
                    }
                    LightningWalletServices vm = new LightningWalletServices();
                    vm.ShowQR     = showQR;
                    vm.WalletName = service.DisplayName;
                    string tokenParam = "access-key";
                    if (service.Type == ExternalServiceTypes.ThunderHub)
                    {
                        tokenParam = "token";
                    }
                    vm.ServiceLink = $"{connectionString.Server}?{tokenParam}={connectionString.AccessKey}";
                    return(View("LightningWalletServices", vm));

                case ExternalServiceTypes.CLightningRest:
                    return(LndServices(service, connectionString, nonce, "CLightningRestServices"));

                case ExternalServiceTypes.LNDGRPC:
                case ExternalServiceTypes.LNDRest:
                    return(LndServices(service, connectionString, nonce));

                case ExternalServiceTypes.Configurator:
                    return(View("ConfiguratorService",
                                new LightningWalletServices()
                    {
                        ShowQR = showQR,
                        WalletName = service.ServiceName,
                        ServiceLink = $"{connectionString.Server}?password={connectionString.AccessKey}"
                    }));

                default:
                    throw new NotSupportedException(service.Type.ToString());
                }
            }
            catch (Exception ex)
            {
                TempData[WellKnownTempData.ErrorMessage] = ex.Message;
                return(RedirectToAction(nameof(Services)));
            }
        }