// This is where Windows Service behavior over TFSMigrationDb lives... look for work to do when waking up
        private void RestartActiveSessionGroups()
        {
            TraceManager.TraceInformation("RestartActiveSessionGroups: Enter");

            BusinessModelManager businessModelManager = new BusinessModelManager();

            List <Guid> activeSessionGroupUniqueIds = businessModelManager.GetActiveSessionGroupUniqueIds();

            TraceManager.TraceInformation("RestartActiveSessionGroups: BusinessModelManager returned # sessions: {0}", activeSessionGroupUniqueIds.Count);

            foreach (Guid activeSessionGroupUniqueId in activeSessionGroupUniqueIds)
            {
                m_migrationServiceProxy.StartSessionGroup(activeSessionGroupUniqueId);
            }
        }
        /// <summary>
        /// Try saving the managed configuration (always check whether the configuration can be saved or not)
        /// </summary>
        /// <returns>The Id of the saved configuration</returns>
        /// <exception cref="Microsoft.TeamFoundation.Migration.BusinessModel.DuplicateConfigurationException" />
        public int TrySave()
        {
            if (CanEditAndSave)
            {
                return(SaveConfigWithoutCanSaveCheck());
            }
            else
            {
                var  pipeProxy = new MigrationServiceClient();
                bool sessionWasRunningBeforeSavingConfig = false;
                try
                {
                    var runningGroups = pipeProxy.GetRunningSessionGroups();
                    sessionWasRunningBeforeSavingConfig = runningGroups.Contains(Configuration.SessionGroupUniqueId);

                    if (sessionWasRunningBeforeSavingConfig)
                    {
                        pipeProxy.StopSessionGroup(Configuration.SessionGroupUniqueId);

                        if (!WaitForSessionGroupToStop(pipeProxy, TimeSpan.TicksPerMinute * 10))
                        {
                            throw new SavingUnsavableConfigurationException(Configuration);
                        }
                    }
                }
                catch (MigrationServiceEndpointNotFoundException)
                {
                    // WCF service is not active - session group shouldn't be running either
                }

                int saveResult = SaveConfigWithoutCanSaveCheck();

                if (sessionWasRunningBeforeSavingConfig)
                {
                    try
                    {
                        pipeProxy.StartSessionGroup(Configuration.SessionGroupUniqueId);
                    }
                    catch (MigrationServiceEndpointNotFoundException)
                    {
                        TraceManager.TraceInformation("Cannot restart Session Group '{0}' after updating its configuration.",
                                                      Configuration.SessionGroupUniqueId.ToString());
                    }
                }

                return(saveResult);
            }
        }