/// <summary>
        /// Called when the collection is being closed
        /// </summary>
        internal void OnClose()
        {
            MasterCollection.Dispatcher.VerifyAccess();
            MasterCollection.RaiseDisconnected();

            foreach (ObjectEntry entry in this.Items.Values)
            {
                entry.RemoveParent(this.Id);
            }
            this.Items.Clear();
            this.SetConnected(false, false);

            try
            {
                ignoreChanges = true;
                MasterCollection.ClearSharedCollection();
            }
            finally
            {
                ignoreChanges = false;
            }
        }