internal void Dispose() { foreach (var child in _children) { child.Dispose(); } _children.Clear(); // Delete self from scopes and objects. _connection.RemoveScope(_guid); _connection.RemoveObject(_guid); // Delete all of the objects from connection. foreach (string guid in _objects.Keys) { _connection.RemoveObject(guid); } if (Parent != null) { Parent.RemoveObject(_guid); Parent.RemoveChild(this); } }