I don't like the idea that this is basically a bunch of logic that checks the runtime type of the Mapping. It's generally better to design classes in a way such that code pertaining to a base class doesn't concern itself with which derived class it is instantiated by. I don't really understand how to fix this correctly yet because this class is so undocumented I can't figure out what it's even doing, but you should be able to figure out a way to deal with this appropriately, using enums or a generic or _something_.