private void toolStripButtonStopAdapter_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem item in listViewIntegrations.SelectedItems)
            {
                // Make sure to pass item as parameter, otherwise the value is in foreach and chages before the thread starts.
                GeneralHelper.FireAndForget(delegate(ListViewItem itemValue)
                {
                    IIntegrationAdapter adapter = (IIntegrationAdapter)itemValue.Tag;
                    System.Diagnostics.Trace.WriteLine(adapter.Name);
                    string operationResultMessage;
                    adapter.Stop(out operationResultMessage);

                    WinFormsHelper.BeginManagedInvoke(this, UpdateUI);
                }, item);
            }
        }
        void Adapters_ItemRemovedEvent(GenericContainer <IIntegrationAdapter> keeper, IIntegrationAdapter adapter)
        {
            string operationResultMessage;

            adapter.Stop(out operationResultMessage);
            if (Arbiter != null)
            {
                Arbiter.RemoveClient(adapter);
            }
            adapter.PersistenceDataUpdateEvent -= new IntegrationAdapterUpdateDelegate(adapter_PersistenceDataUpdateEvent);
            adapter.Dispose();

            if (OperationalState != OperationalStateEnum.Unknown)
            {
                RaisePersistenceDataUpdatedEvent();
            }
        }
        void Adapters_ItemRemovedEvent(GenericContainer<IIntegrationAdapter> keeper, IIntegrationAdapter adapter)
        {
            string operationResultMessage;
            adapter.Stop(out operationResultMessage);
            if (Arbiter != null)
            {
                Arbiter.RemoveClient(adapter);
            }
            adapter.PersistenceDataUpdateEvent -= new IntegrationAdapterUpdateDelegate(adapter_PersistenceDataUpdateEvent);
            adapter.Dispose();

            if (OperationalState != OperationalStateEnum.Unknown)
            {
                RaisePersistenceDataUpdatedEvent();
            }
        }