/// <summary>
        /// Check status of results from search with specified id
        /// </summary>
        public DomainSearchData CheckStatus(int domainSearchId)
        {
            var results = new List<DomainResult>();

            var statusData = DomainSearchHelper.GetAvailabilityStatus(
                domainSearchId.ToString(),
                BillingApi.Service,
                Guid.Empty,
                resellerId,
                this.shopNameProvider.GetShopName(),
                currencyCode,
                countryCode);
            
            int transactionId;
            if (!Int32.TryParse(statusData.TransactionId, out transactionId))
            {
                transactionId = -1;
            };

            foreach(var domain in statusData.DomainStatuses)
            {
                var domainResult = CreateDomainResult(domain.ProductId, domain.Status, domain.DomainName, transactionId);
                results.Add(domainResult);
            }

            var data = new DomainSearchData
            {
                DomainSearchId = transactionId,
                FinishSearch = statusData.FinishSearch,
                Results = results
            };

            return data;
        }
        /// <summary>
        /// Find domain names that match search terms.
        /// </summary>
        /// <param name="searchTerms">A list of search terms</param>
        /// <returns>A list of domain names that match the search terms</returns>
        public DomainSearchData FindDomains(ICollection<string> searchTerms)
        {
            var results = new List<DomainResult>();

            var domainNames = GetDomainNames(searchTerms);
            var unavailableDomains = CheckLocalStatus(domainNames);
            var domainNamesToCheck = GetDomainNamesToCheck(domainNames, unavailableDomains);
            var checkedDomains = StartSearch(domainNamesToCheck);

            foreach (var domain in checkedDomains.Concat(unavailableDomains))
            {
                var domainResult = CreateDomainResult(domain.ProductID, domain.ProductStatus, domain.ProductName, domain.TransactionId);
                results.Add(domainResult);
            }

            var firstCheckedDomain = checkedDomains.FirstOrDefault();
            var domainSearchId = firstCheckedDomain != null ? firstCheckedDomain.TransactionId : -1;

            var data = new DomainSearchData
            {
                FinishSearch = !results.Any(r => r.Status == DomainResult.LOADING),
                DomainSearchId = domainSearchId,
                Results = results
            };

            return data;
        }
        public DomainSearchData FindDomains(ICollection<string> searchTerms)
        {
            var results = new List<DomainResult>();
            var searchTerm = searchTerms.First();

            var premiumTlds = new Dictionary<string, string> 
            {
                {"com", DomainResult.AVAILABLE},
                {"org", DomainResult.AVAILABLE},
                {"net", DomainResult.AVAILABLE},
            };

            var secondaryTlds = new Dictionary<string, string> 
            {
                {"se", DomainResult.AVAILABLE},
                {"eu", DomainResult.UNAVAILABLE},
                {"info", DomainResult.UNKNOWN},
                {"co.uk", DomainResult.AVAILABLE},
                
                // Uncomment if you need to test many tlds. Also see FakeCategoryProductsProvider
                /*{"de", DomainResult.AVAILABLE},
                {"fr", DomainResult.UNAVAILABLE},
                {"dk", DomainResult.AVAILABLE},
                {"fi", DomainResult.UNAVAILABLE},
                {"es", DomainResult.AVAILABLE},
                {"co", DomainResult.UNAVAILABLE},
                {"it", DomainResult.AVAILABLE},
                {"io", DomainResult.UNAVAILABLE},
                {"cloud", DomainResult.AVAILABLE},
                {"global", DomainResult.UNAVAILABLE},
                {"be", DomainResult.AVAILABLE},
                {"ca", DomainResult.UNAVAILABLE},
                {"mx", DomainResult.AVAILABLE},
                {"pro", DomainResult.UNAVAILABLE},
                {"aero", DomainResult.AVAILABLE},
                {"asia", DomainResult.UNAVAILABLE},
                {"au", DomainResult.AVAILABLE},
                {"cl", DomainResult.UNAVAILABLE},
                {"coop", DomainResult.AVAILABLE},
                {"my", DomainResult.UNAVAILABLE},
                {"sg", DomainResult.AVAILABLE},
                {"hk", DomainResult.UNAVAILABLE},
                {"hu", DomainResult.AVAILABLE},
                {"jobs", DomainResult.UNAVAILABLE},
                {"lv", DomainResult.AVAILABLE},
                {"no", DomainResult.UNAVAILABLE},
                {"nyc", DomainResult.AVAILABLE},
                {"pm", DomainResult.UNAVAILABLE},
                {"re", DomainResult.AVAILABLE},
                {"tf", DomainResult.UNAVAILABLE},
                {"wf", DomainResult.AVAILABLE},
                {"yt", DomainResult.UNAVAILABLE},
                {"ro", DomainResult.AVAILABLE},
                {"ru", DomainResult.UNAVAILABLE},
                {"nu", DomainResult.AVAILABLE},
                {"travel", DomainResult.UNAVAILABLE}*/
            };

            if (!string.IsNullOrEmpty(searchTerm))
            {
                lastSearchTerm = searchTerm;
                var renewalPeriods = new List<RenewalPeriod> { new RenewalPeriod(1, RenewalPeriod.YEAR) };

                var i = 0;
                foreach (var tld in premiumTlds)
                {
                    var domainResult = new DomainResult(
                        new Product
                        {
                            ArticleNumber = "DMN-" + tld.Key.ToUpper(),
                            PricingVariants = renewalPeriods.Select(r => new PricingVariant { Price = 10m, RenewalPeriod = r }).ToList(),
                            CustomAttributes = new List<CustomAttribute> { 
                                new CustomAttribute { Name = "Premium", Value = "true"} ,
                                new CustomAttribute { Name = "productvalue", Value = "." + tld.Key} ,
                            }
                        },
                        tld.Key,
                        searchTerm + "." + tld.Key,
                        tld.Value,
                        1
                    );

                    domainResult.Order = i++;

                    results.Add(domainResult);
                }

                foreach (var tld in secondaryTlds)
                {
                    var domainResult = new DomainResult(
                        new Product
                        {
                            ArticleNumber = "DMN-" + tld.Key.ToUpper(),
                            PricingVariants = renewalPeriods.Select(r => new PricingVariant { Price = 10m, RenewalPeriod = r }).ToList(),
                            CustomAttributes = new List<CustomAttribute> { 
                                    new CustomAttribute { Name = "productvalue", Value = "." + tld.Key} ,
                                }
                        },
                        tld.Key,
                        searchTerm + "." + tld.Key,
                        tld.Value,
                        1
                    );

                    domainResult.Order = i++;

                    results.Add(domainResult);
                }
            }

            var data = new DomainSearchData
            {
                FinishSearch = false,
                DomainSearchId = 1,
                Results = results
            };

            return data;
        }