EntityQuery refactoring