private List <PublishedExtension> GetNextPageFromMarketplace(int pageNumber, int pageSize, String vsVersion, IEnumerable <string> skus)
        {
            try
            {
                ExtensionQuery     query     = CreateQueryForExtensions(pageNumber, pageSize, skus, vsVersion);
                HttpRequestMessage request   = new HttpRequestMessage(HttpMethod.Post, new Uri(s_extensionQueryUrl));
                String             queryJson = JsonConvert.SerializeObject(query);
                request.Content = new StringContent(queryJson, Encoding.UTF8, "application/json");
                request.Headers.TryAddWithoutValidation("User-Agent", "VSIDE-VSPackageInstaller" + vsVersion);

                HttpResponseMessage response = _httpClient.SendAsync(request).Result;
                String jsonString            = response.Content.ReadAsStringAsync().Result;
                ExtensionQueryResult result  = JsonConvert.DeserializeObject <ExtensionQueryResult>(jsonString);
                return(result.Results[0].Extensions);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        private ExtensionQuery CreateQueryForExtensions(int pageNumber, int pageSize, IEnumerable <String> skus, string vsVersion)
        {
            ExtensionQuery query = new ExtensionQuery();

            query.Filters = new List <QueryFilter>()
            {
                new QueryFilter()
                {
                    PageNumber = pageNumber,
                    Criteria   = new List <FilterCriteria>()
                    {
                        new FilterCriteria()
                        {
                            FilterType = 15,
                            Value      = vsVersion
                        },
                        new FilterCriteria()
                        {
                            FilterType = 14,
                            Value      = "1033"
                        }
                    },
                    PageSize  = pageSize,
                    SortBy    = 1,
                    SortOrder = 2
                }
            };
            //assuming skus are like Ultimate, Community etc. we will add prefix as needed by Marketplace
            foreach (string sku in skus)
            {
                query.Filters[0].Criteria.Add(new FilterCriteria()
                {
                    FilterType = 8,
                    Value      = "Microsoft.VisualStudio." + sku
                });
            }
            return(query);
        }