C# - Get the ModelDoc2 of an assembly or part when selected from a drawings browser tree.

In a drawing document I need to capture the ModelDoc2 of the selected Sub Assembly or Part when selected from the browser tree.

According to GetSelectedObjectType, the selected object is of type swSelectType_e.swSelCOMPONENTS but when I then try to cast the return value as a component, I get the following error:

"Unable to cast COM object of type 'System.__ComObject' to interface type 'SolidWorks.Interop.sldworks.IComponent2'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{655D6F2A-5441-45D1-8CBA-D35FB26988E4}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

If I switch to a Component instead of an IComponent2

"Unable to cast COM object of type 'System.__ComObject' to interface type 'SolidWorks.Interop.sldworks.Component'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{83A33D9A-27C5-11CE-BFD4-00400513BB57}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

This tells me that what is selected is not a component, but what else could it be?  Any suggestions?

SolidworksApi macros