/// <summary>
        /// Changes the host information of a url to match that of the selected region
        /// </summary>
        /// <param name="url">URL to change</param>
        /// <param name="region">Region to get host information from. If null uri is not changed.</param>
        /// <returns>Modified URI</returns>
        internal static string ChangeUrlRegion(this string url, Region region)
        {
            if (string.IsNullOrWhiteSpace(url)) throw new ArgumentNullException(nameof(url));

            if (region == null) return url;
            var uri = new Uri(url).ChangeUriRegion(region);
            return uri.ToString();
        }
 /// <summary>
 /// Changes the host information of a url to match that of the selected region
 /// </summary>
 /// <param name="uri">URL to change</param>
 /// <param name="region">Region to get host information from. If null uri is not changed.</param>
 /// <returns>Modified URI</returns>
 internal static Uri ChangeUriRegion(this Uri uri, Region region)
 {
     if (uri == null) throw new ArgumentNullException(nameof(uri));
     if (region != null)
     {
         var path = uri.PathAndQuery;
         var host = path.StartsWith(BattleNetDefaults.UserInformationEndpoint, StringComparison.OrdinalIgnoreCase) ? region.ApiHost : region.OAuthHost;
         var baseUri = new Uri("https://" + host);
         uri = new Uri(baseUri, path);
     }
     return uri;
 }