/// <summary>
        /// Process controllers for current HTTP request
        /// </summary>
        /// <param name="resolver">The DI container resolver.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public async Task <ControllersProcessorResult> ProcessControllers(IDIResolver resolver, HttpContext context)
        {
            var atleastOneNonAnyPageControllerMatched = false;

            foreach (var controller in _agent.GetStandardControllersMetaData())
            {
                var matcherResult = _agent.MatchControllerRoute(controller, context.Request.Path.Value, context.Request.Method);

                if (matcherResult == null || !matcherResult.Success)
                {
                    continue;
                }

                var securityResult = _agent.IsSecurityRulesViolated(controller, context.User);

                if (securityResult == SecurityRuleCheckResult.NotAuthenticated)
                {
                    return(ControllersProcessorResult.Http401);
                }

                if (securityResult == SecurityRuleCheckResult.Forbidden)
                {
                    return(await ProcessForbiddenSecurityRule(resolver, context));
                }

                var result = await ProcessController(controller, resolver, context, matcherResult.RouteParameters);

                if (result != ControllersProcessorResult.Ok)
                {
                    return(result);
                }

                if (!_agent.IsAnyPageController(controller))
                {
                    atleastOneNonAnyPageControllerMatched = true;
                }
            }

            if (!atleastOneNonAnyPageControllerMatched)
            {
                var result = await ProcessOnlyAnyPageControllersMatched(resolver, context);

                if (result != ControllersProcessorResult.Ok)
                {
                    return(result);
                }
            }
            else
            {
                _redirector.SetPreviousPageUrlToCurrentPage();
            }

            return(ControllersProcessorResult.Ok);
        }
        /// <summary>
        /// Process controllers for current HTTP request
        /// </summary>
        /// <param name="resolver">The DI container resolver.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public ControllersProcessorResult ProcessControllers(IDIResolver resolver, HttpContext context)
        {
            var atleastOneNonAnyPageControllerMatched = false;

            foreach (var metaData in _agent.GetStandardControllersMetaData())
            {
                var matcherResult = _agent.MatchControllerRoute(metaData, context.Request.Path.Value, context.Request.Method);

                if (matcherResult == null || !matcherResult.Success)
                {
                    continue;
                }

                var securityResult = _agent.IsSecurityRulesViolated(metaData, context.User);

                if (securityResult == SecurityRuleCheckResult.NotAuthenticated)
                {
                    return(ControllersProcessorResult.Http401);
                }

                if (securityResult == SecurityRuleCheckResult.Forbidden)
                {
                    return(ProcessForbiddenSecurityRule(resolver, context));
                }

                var result = ProcessController(metaData.ControllerType, resolver, context, matcherResult.RouteParameters);

                if (result != ControllersProcessorResult.Ok)
                {
                    return(result);
                }

                if (!_agent.IsAnyPageController(metaData))
                {
                    atleastOneNonAnyPageControllerMatched = true;
                }
            }

            if (!atleastOneNonAnyPageControllerMatched)
            {
                var result = ProcessOnlyAnyPageControllersMatched(resolver, context);
                if (result != ControllersProcessorResult.Ok)
                {
                    return(result);
                }
            }

            return(ProcessAsyncControllersResponses(resolver));
        }