All you need is a custom model that maps subtrees to submodels.