protected override void CompleteDialogExtention()
        {
            base.CompleteDialogExtention();
            var connections = ApplicationController.ResolveType <ISavedXrmConnections>();

            if (connections.Connections.Any(c => c.Active))
            {
                var savedConfig  = connections.Connections.First(c => c.Active);
                var recordconfig =
                    new ObjectMapping.ClassMapperFor <SavedXrmRecordConfiguration, XrmRecordConfiguration>().Map(savedConfig);
                ApplicationController.ResolveType <ISettingsManager>().SaveSettingsObject(recordconfig);
                SavedXrmConnectionsModule.RefreshXrmServices(recordconfig, ApplicationController);
            }
        }
        protected override void CompleteDialogExtention()
        {
            ObjectToEnter.HideActive = false;
            //uh huh - okay now
            ObjectToEnter.Active = true;
            //lets set the connection in the service our parent dialog is using
            if (XrmRecordService != null)
            {
                XrmRecordService.XrmRecordConfiguration = ObjectToEnter;
            }
            //lets also refresh it in the applications containers
            SavedXrmConnectionsModule.RefreshXrmServices(ObjectToEnter, ApplicationController, xrmRecordService: XrmRecordService);
            //lets also refresh it in the saved settings
            var appSettingsManager     = ApplicationController.ResolveType(typeof(ISettingsManager)) as ISettingsManager;
            var savedConnectionsObject = ApplicationController.ResolveType <ISavedXrmConnections>();

            if (savedConnectionsObject.Connections != null)
            {
                foreach (var item in savedConnectionsObject.Connections)
                {
                    item.Active = false;
                }
            }
            savedConnectionsObject.Connections
                = savedConnectionsObject.Connections == null
                ? new [] { ObjectToEnter }
                : savedConnectionsObject.Connections.Union(new [] { ObjectToEnter }).ToArray();
            appSettingsManager.SaveSettingsObject(savedConnectionsObject);
            var recordconfig =
                new ObjectMapping.ClassMapperFor <SavedXrmRecordConfiguration, XrmRecordConfiguration>().Map(ObjectToEnter);

            appSettingsManager.SaveSettingsObject(recordconfig);

            if (!HasParentDialog)
            {
                CompletionItem = new CompletedMessage();
            }
        }