protected override void ApplySettingsChanges(KeyValueConfigurationCollection settings)
        {
            if (!ForwardErrorMessages)
            {
                ErrorLogQueue = null;
            }

            if (!ForwardAuditMessages)
            {
                AuditLogQueue = null;
            }

            settings.Set(ServiceControlSettings.HostName, HostName);
            settings.Set(ServiceControlSettings.Port, Port.ToString());
            settings.Set(ServiceControlSettings.DatabaseMaintenancePort, DatabaseMaintenancePort.ToString(), Version);
            settings.Set(ServiceControlSettings.LogPath, LogPath);
            settings.Set(ServiceControlSettings.ForwardAuditMessages, ForwardAuditMessages.ToString(), Version);
            settings.Set(ServiceControlSettings.ForwardErrorMessages, ForwardErrorMessages.ToString(), Version);
            settings.Set(ServiceControlSettings.AuditRetentionPeriod, AuditRetentionPeriod.ToString(), Version);
            settings.Set(ServiceControlSettings.ErrorRetentionPeriod, ErrorRetentionPeriod.ToString(), Version);
            settings.RemoveIfRetired(ServiceControlSettings.HoursToKeepMessagesBeforeExpiring, Version);
            settings.Set(ServiceControlSettings.AuditQueue, AuditQueue, Version);
            settings.Set(ServiceControlSettings.ErrorQueue, ErrorQueue);
            settings.Set(ServiceControlSettings.AuditLogQueue, AuditLogQueue, Version);
            settings.Set(ServiceControlSettings.ErrorLogQueue, ErrorLogQueue, Version);

            if (RemoteInstances != null)
            {
                if (Compatibility.RemoteInstancesDoNotNeedQueueAddress.SupportedFrom <= Version)
                {
                    foreach (var instance in RemoteInstances)
                    {
                        instance.QueueAddress = null;
                    }
                }

                settings.Set(ServiceControlSettings.RemoteInstances, RemoteInstanceConverter.ToJson(RemoteInstances), Version);
            }
        }