public ABaseController(IConfiguration config, IDbSettingsReader settings, ILogger logger) : base()
        {
            this.Settings    = settings;
            this.Config      = config;
            this.Views       = new ViewNames();
            this.Logger      = logger;
            this.Controllers = new ControllerNames
            {
                DashboardController = Settings.GetAppDashboardControllerName(),
                MyProfileController = Settings.GetAppMyProfileControllerName(),
                AccountController   = Settings.GetAccountControllerName(),
                UninstallController = Settings.GetAppUninstallControllerName()
            };

            this.VersionInfo = new Versions()
            {
                AppVersion                 = settings.GetAppVersion(),
                FrameWorkVersion           = AppSettingsAccessor.GetFrameWorkBuildNumber(),
                DataSeederFrameworkVersion = Settings.GetDataSeederFrameworkVersion()
            };
        }
        public void OnAuthorization(AuthorizationFilterContext context)
        {
            _Logger.LogInformation($"Started checking requirement {_Requirement.ToString()}");
            if (context.Result == null)
            {
                _Logger.LogInformation("Getting current user.");
                var user = _UserCache.GetLoggedOnUser().Result;
                if (user == null)
                {
                    _Logger.LogWarning("User must be logged on before checking subscription.Redirecting to login page.");
                    context.Result = new RedirectToActionResult(ACCOUNT_ACTIONS.Login.ToString(), _Settings.GetAccountControllerName(), new { });
                }
                else
                {
                    _Logger.LogInformation($"Current user is '{user.MyShopifyDomain}'");
                    if (user.PlanId.HasValue == false)
                    {
                        _Logger.LogError($"Current user '{user.MyShopifyDomain}' doesn't have any valid plan.Throwing error.");
                        throw new Exception("Your account is not associated with any valid plan.Contact Support.");
                    }
                    else
                    {
                        bool requirementMet = false;
                        if (_PlanReader[user.PlanId.Value] == null)
                        {
                            _Logger.LogError($"Current user '{user.MyShopifyDomain}'  plan id ='{user.PlanId.Value}' is not found in the loaded plans list.");
                            throw new Exception($"Current user '{user.MyShopifyDomain}' plan id ='{user.PlanId.Value}' is not found in the loaded plans list.");
                        }
                        else if (_PlanReader[user.PlanId.Value].IsDev)
                        {
                            _Logger.LogInformation("Plan requirement is waved because user has DEV plan.");
                            requirementMet = true;
                        }
                        else
                        {
                            if (user.PlanId.Value != _Requirement.PlanId)
                            {
                                _Logger.LogWarning($"User '{user.MyShopifyDomain}' doesn't have required plan id = '{_Requirement.PlanId}'.");
                            }
                            else
                            {
                                PlanAppModel userPlan = _PlanReader[user.PlanId.Value];
                                _Logger.LogInformation($"User '{user.MyShopifyDomain}' has plan id = '{userPlan.Id}' and name = '{userPlan.Name}'");

                                if (_Requirement.OptionName != null && _Requirement.ExpectedValue != null)
                                {
                                    if (_PlanReader[userPlan.Id, _Requirement.OptionName]?.OptionValue == _Requirement.ExpectedValue)
                                    {
                                        requirementMet = true;
                                        _Logger.LogInformation($"User '{user.MyShopifyDomain}' has valid plan '{userPlan.Name}' and valid value = '{_Requirement.ExpectedValue}' for option = '{_Requirement.OptionName}'.");
                                    }
                                    else
                                    {
                                        _Logger.LogWarning($"User '{user.MyShopifyDomain}' plan = '{userPlan.Name}' doesn't have expected value for option ='{_Requirement.OptionName}'.");
                                    }
                                }
                                else
                                {
                                    _Logger.LogInformation($" User '{user.MyShopifyDomain}' hsa required plan.");
                                    requirementMet = true;
                                }
                            }

                            var controller = context.RouteData.Values["controller"];
                            var action     = context.RouteData.Values["action"];
                            if (!requirementMet)
                            {
                                _Logger.LogWarning($"User '{user.MyShopifyDomain}' is denied to '{controller}/{action}' route. Redirecting to app dashboard.");
                                context.Result = new RedirectToRouteResult(
                                    new RouteValueDictionary()
                                {
                                    { "controller", _Settings.GetAppDashboardControllerName() },
                                    { "action", DASHBOARD_ACTIONS.PlanDoesNotAllow.ToString() }
                                });
                            }
                            else
                            {
                                _Logger.LogInformation($"Requirement met. User '{user.MyShopifyDomain}' is allowed to '{controller}/{action}' route.");
                            }
                        }
                    }
                }
            }
        }