very nice erfajo! Thanks for building upon that example and sharing it. The document conversion was a frustration for a very long time and I too was glad to realize I could use reflection for it (it actually came up here). The code you shared is great and I’m sure it’s going to help a lot of people looking to convert between types (especially those annoying internal types).
Also, like you, I will be making sure to return the dynamo types wherever possible in the future. (No more Autodesk.Revit.DB.Document getting returned in rhythm).