DRY refactoring for query methods