Migrating the query building to a sub class.