/// <returns>A task that represents the asynchronous operation</returns>
        public virtual async Task <IActionResult> CancelRecurringPayment(int id)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageRecurringPayments))
            {
                return(AccessDeniedView());
            }

            //try to get a recurring payment with the specified id
            var payment = await _orderService.GetRecurringPaymentByIdAsync(id);

            if (payment == null)
            {
                return(RedirectToAction("List"));
            }

            try
            {
                var errors = await _orderProcessingService.CancelRecurringPaymentAsync(payment);

                if (errors.Any())
                {
                    foreach (var error in errors)
                    {
                        _notificationService.ErrorNotification(error);
                    }
                }
                else
                {
                    _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.RecurringPayments.Cancelled"));
                }

                //prepare model
                var model = await _recurringPaymentModelFactory.PrepareRecurringPaymentModelAsync(null, payment);

                //selected card
                SaveSelectedCardName("recurringpayment-history", persistForTheNextRequest: false);

                return(View(model));
            }
            catch (Exception exc)
            {
                await _notificationService.ErrorNotificationAsync(exc);

                //prepare model
                var model = await _recurringPaymentModelFactory.PrepareRecurringPaymentModelAsync(null, payment);

                //selected card
                SaveSelectedCardName("recurringpayment-history", persistForTheNextRequest: false);

                return(View(model));
            }
        }