Improve resource handling in Parent/ChildQuery