public void AddCodeForSubRegion(string szCode, string szRegion)
 {
     AddCode(szCode);
     if (!String.IsNullOrWhiteSpace(szRegion))
     {
         if (!mSubRegions.ContainsKey(szRegion))
         {
             mSubRegions[szRegion] = new VisitedRegion(szRegion);
         }
         mSubRegions[szRegion].AddCode(szCode);
     }
 }
        /// <summary>
        /// Returns a set of visited regions
        /// </summary>
        /// <param name="rgva">A list of airports</param>
        /// <returns>An enumerable of visited regions.</returns>
        public static IEnumerable <VisitedRegion> VisitedCountriesAndAdmins(IEnumerable <VisitedAirport> rgva)
        {
            Dictionary <string, VisitedRegion> dCountries = new Dictionary <string, VisitedRegion>();

            if (rgva == null)
            {
                return(dCountries.Values);
            }

            foreach (VisitedAirport va in rgva)
            {
                string szCountry = va.Airport.CountryDisplay;
                string szAdmin   = va.Airport.Admin1Display;
                if (String.IsNullOrEmpty(szCountry))
                {
                    continue;
                }

                if (!dCountries.ContainsKey(szCountry))
                {
                    dCountries[szCountry] = new VisitedRegion(szCountry);
                }

                string[] rgCodes = va.AllCodes.Split(new char[] { ',' });

                foreach (string szCode in rgCodes)
                {
                    dCountries[szCountry].AddCodeForSubRegion(szCode, szAdmin);
                }
            }

            List <VisitedRegion> lst = new List <VisitedRegion>(dCountries.Values);

            lst.Sort((vr1, vr2) => { return(vr1.Name.CompareCurrentCultureIgnoreCase(vr2.Name)); });

            return(lst);
        }