private async void ButtonDiscoverEndpoint_Click(object sender, RoutedEventArgs e)
        {
            if (Model.ActiveWeblogInfo == null)
            {
                return;
            }

            var discover = new BlogEndpointDiscovery();

            var url = Model.ActiveWeblogInfo.ApiUrl;

            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            StatusBar.ShowStatusProgress("Checking Endpoint Url...");

            if (await discover.CheckRpcEndpointAsync(url))
            {
                StatusBar.ShowStatusSuccess("The Weblog Endpoint is a valid RPC endpoint.", 10000);
                return;
            }

            StatusBar.ShowStatusProgress("Checking for RSD links...");

            var blogInfo = await discover.DiscoverBlogEndpointAsync(url, Model.ActiveWeblogInfo.BlogId as string,
                                                                    Model.ActiveWeblogInfo.Type.ToString());

            if (blogInfo.HasError)
            {
                if (url.IndexOf("medium.com", StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    Model.ActiveWeblogInfo.ApiUrl = "https://api.medium.com/v1/";
                    Model.ActiveWeblogInfo.Type   = WeblogTypes.Medium;
                    StatusBar.ShowStatusSuccess("Weblog API Endpoint Url found and updated.");
                    return;
                }

                StatusBar.ShowStatusError($"Endpoint Discovery: {blogInfo.ErrorMessage}");
                return;
            }

            Model.ActiveWeblogInfo.ApiUrl = blogInfo.ApiUrl;
            Model.ActiveWeblogInfo.BlogId = blogInfo.BlogId;
            if (blogInfo.BlogType == "MetaWeblog" || blogInfo.BlogType == "MetaWeblogApi")
            {
                Model.ActiveWeblogInfo.Type = WeblogTypes.MetaWeblogApi;
            }
            else if (blogInfo.BlogType == "WordPress")
            {
                Model.ActiveWeblogInfo.Type = WeblogTypes.Wordpress;
            }
            else
            {
                Model.ActiveWeblogInfo.Type = WeblogTypes.Unknown;
            }

            StatusBar.ShowStatusSuccess("Weblog API Endpoint Url found and updated.", 6000);
        }
        private async void RsdToUrlTest(string discoveryUrl)
        {
            var             discover = new BlogEndpointDiscovery();
            BlogApiEndpoint ep       = await discover.DiscoverBlogEndpointAsync(discoveryUrl, "1", "MetaWeblog");

            Assert.IsNotNull(ep);
            Console.WriteLine(ep.ApiUrl + " " + ep.BlogType + " - " + ep.BlogId + "\r\n" + ep.Rsd);
            Assert.AreNotEqual(discoveryUrl, ep.ApiUrl);
        }
        public async void DiscoverFSharpForWestWindBlogNoRDS()
        {
            // no RDS
            string discoveryUrl = "http://weblog.west-wind.com/metaweblogapi.ashx";

            var             discover = new BlogEndpointDiscovery();
            BlogApiEndpoint ep       = await discover.DiscoverBlogEndpointAsync(discoveryUrl, "1", "MetaWeblog");


            Assert.IsNotNull(ep);
            Console.WriteLine(ep.ApiUrl + " " + ep.BlogType + " - " + ep.BlogId + "\r\n" + ep.Rsd);
            Assert.AreEqual(discoveryUrl, ep.ApiUrl);
        }