public static IEnumerable <Request> GetRequests(Site site, Filter filter = null)
        {
            if (site == null)
            {
                throw new ArgumentNullException(nameof(site));
            }

            // Get all application pools for the site
            Dictionary <string, ApplicationPool> pools = new Dictionary <string, ApplicationPool>();

            foreach (var app in site.Applications)
            {
                if (!string.IsNullOrEmpty(app.ApplicationPoolName) && !pools.ContainsKey(app.ApplicationPoolName))
                {
                    var pool = AppPoolHelper.GetAppPool(app.ApplicationPoolName);
                    if (pool != null)
                    {
                        pools[app.ApplicationPoolName] = pool;
                    }
                }
            }

            // Get all worker processes running in the app pools
            List <WorkerProcess> wps = new List <WorkerProcess>();

            foreach (var pool in pools.Values)
            {
                wps.Concat(WorkerProcessHelper.GetWorkerProcesses(pool));
            }

            var result = new List <Request>();

            foreach (var wp in wps)
            {
                foreach (var req in GetRequests(wp, filter))
                {
                    if (req.SiteId == site.Id)
                    {
                        result.Add(req);
                    }
                }
            }

            return(result);
        }
        public static IEnumerable <Request> GetRequests(Site site, Filter filter = null)
        {
            if (site == null)
            {
                throw new ArgumentNullException(nameof(site));
            }

            var result = new List <Request>();

            foreach (var wp in WorkerProcessHelper.GetWorkerProcesses(site))
            {
                foreach (var r in GetRequests(wp, filter))
                {
                    if (r.SiteId == site.Id)
                    {
                        result.Add(r);
                    }
                }
            }

            return(result);
        }