C# Node Error: Element is not registered

I’ve made some adjustments to my code and I’m not experiencing this error any more. There’s a new topic for the subsequent error here.

For reference I got rid of the error by not using the Element type at all. Just adding the FamilyInstance directly to the list of elements.