public async Task <ActionResult> Switch(NotificationSwitcherViewModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Number) ||
                string.IsNullOrWhiteSpace(model.OriginalNumber) ||
                model.Number.Equals(model.OriginalNumber, StringComparison.OrdinalIgnoreCase))
            {
                return(RedirectToAction("Index", "Home", new { area = "Admin" }));
            }

            var info = await mediator.SendAsync(new GetNotificationInfo(model.Number));

            if (info.IsExistingNotification)
            {
                if (info.TradeDirection == TradeDirection.Export)
                {
                    var financialGuaranteeDecisionRequired = await mediator.SendAsync(new GetFinancialGuaranteeDecisionRequired(info.Id.Value));

                    switch (info.ExportNotificationStatus)
                    {
                    case NotificationStatus.Consented:
                        if (financialGuaranteeDecisionRequired)
                        {
                            return(RedirectToAction("Index", "FinancialGuaranteeAssessment", new { id = info.Id, area = "AdminExportAssessment" }));
                        }
                        return(RedirectToAction("Index", "Home", new { id = info.Id, area = "AdminExportNotificationMovements" }));

                    case NotificationStatus.ConsentWithdrawn:
                        var hasHadAnyFinancialGuarantee = await mediator.SendAsync(new CheckFinancialGuaranteeStatus(info.Id.Value));

                        if (!hasHadAnyFinancialGuarantee)
                        {
                            return(RedirectToAction("Index", "Home", new { id = info.Id, area = "AdminExportAssessment" }));
                        }
                        return(RedirectToAction("Index", "Home", new { id = info.Id, area = "AdminExportNotificationMovements" }));

                    case NotificationStatus.NotSubmitted:
                        break;

                    default:
                        return(RedirectToAction("Index", "Home", new { id = info.Id, area = "AdminExportAssessment" }));
                    }
                }

                if (info.TradeDirection == TradeDirection.Import)
                {
                    switch (info.ImportNotificationStatus)
                    {
                    case ImportNotificationStatus.Consented:
                    case ImportNotificationStatus.ConsentWithdrawn:
                        return(RedirectToAction("Index", "Home", new { id = info.Id, area = "AdminImportNotificationMovements" }));

                    default:
                        return(RedirectToAction("Index", "Home", new { id = info.Id, area = "ImportNotification" }));
                    }
                }
            }

            return(RedirectToAction("NotFound", new { number = model.Number }));
        }
        public async Task<ActionResult> Switch(NotificationSwitcherViewModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Number)
                || string.IsNullOrWhiteSpace(model.OriginalNumber)
                || model.Number.Equals(model.OriginalNumber, StringComparison.OrdinalIgnoreCase))
            {
                return RedirectToAction("Index", "Home", new { area = "Admin" });
            }

            var idAndStatus = await mediator.SendAsync(new GetNotificationIdAndStatusByNumber(model.Number));

            if (idAndStatus.Item1.HasValue && idAndStatus.Item2 != NotificationStatus.NotSubmitted)
            {
                return RedirectToAction("Index", "Home", new { id = idAndStatus.Item1, area = "AdminExportAssessment" });
            }

            return RedirectToAction("NotFound", new { number = model.Number });
        }