internal void Build()
        {
            foreach (var area in Areas)
            {
                if (area.Options.AuthorizeByDefault)
                {
                    AuthorizeByDefaultNamespaces.AddRange(area.Options.Modules);
                }

                if (!String.IsNullOrWhiteSpace(area.Options.RequestPathPrefix))
                {
                    foreach (var module in area.Options.Modules)
                    {
                        if (!RequestPrefix.ContainsKey(module))
                        {
                            RequestPrefix.Add(module, area.Options.RequestPathPrefix);
                        }
                    }
                }

                //module assembly check.
                foreach (var module in area.Modules)
                {
                    if (!module.HasAssembly)
                    {
                        throw new Exception($"Module {module.Options.Id} Assembly is null");
                    }
                }
            }
        }
        public bool ShouldApplyActionAuthorizeConvention(string controllerAssemblyName, IReadOnlyList <object> controllerRouteAttributes)
        {
            if (String.IsNullOrWhiteSpace(controllerAssemblyName))
            {
                throw new ArgumentNullException("ShouldApplyActionAuthorizeConvention controllerAssemblyName is empty");
            }

            if (AuthorizeByDefaultNamespaces.Count > 0)
            {
                var isAuthorizationDefined = !controllerRouteAttributes.Any(x => x.GetType() == typeof(AuthorizeAttribute)) && !controllerRouteAttributes.Any(x => x.GetType() == typeof(AllowAnonymousAttribute));

                if (isAuthorizationDefined)
                {
                    if (AuthorizeByDefaultNamespaces.Contains(controllerAssemblyName))
                    {
                        return(true);
                    }
                }

                return(false);
            }

            return(false);
        }