Are you handling the ObjectsAdded event on the GH_Document or via the canvas? The canvas will relay the document events for whatever document is currently loaded, so you don’t have to worry about when documents get swapped, or loaded, or closed.
The event arguments will also have a field for the document. Plus each object knows which document it belongs to, which you can do by invoking an event on the object and listening to the return value (OnPingDocument()). But note that not every object must at any time belong to a document.