How to replicate custom data classes down a hierarchy