Framework for merging and nesting relational data