How to work with related data in the same data source