/// <summary>
        /// Detects which authentication type/settings the service was previously configured with and
        /// initializes the view models accordingly.
        /// </summary>
        private void RestoreAuthenticationSettings()
        {
            using (XmlConfigHelper configHelper = context.CreateReadOnlyXmlConfigHelper())
            {
                ConfigurationKeyNames configKeys = new ConfigurationKeyNames(this.DesignerData.ServiceName);
                if (configHelper.GetAppSetting(configKeys.UserName) != null)
                {
                    this.runtimeAuthenticationTypeViewModel.RuntimeAuthStrategy = AuthenticationStrategy.UserNamePassword;
                }
                else
                {
                    this.runtimeAuthenticationTypeViewModel.RuntimeAuthStrategy = AuthenticationStrategy.WebServerFlow;

                    string myDomain = configHelper.GetAppSetting(configKeys.Domain);
                    this.runtimeAuthenticationConfigViewModel.IsCustomDomain =
                        myDomain != null && !string.Equals(myDomain, Constants.ProductionDomainUrl, StringComparison.OrdinalIgnoreCase);
                    if (this.runtimeAuthenticationConfigViewModel.IsCustomDomain)
                    {
                        this.runtimeAuthenticationConfigViewModel.MyDomainViewModel.MyDomain = myDomain;
                    }
                }
            }
        }