Check out the Treeview/Gridview widget in the appstore: https://appstore.home.mendix.com/link/app/294/Mendix/TreeView-and-GridView
Since you can have a self reference of an entity this is possible. Create a self reference parent and a self reference child. This way you are not limited to 4 levels. In the entity you could even have a field that contains which level the object is and have a microflow calculate that level.