Refactor Query class reducing duplicate code