It sounds like this is something that could be factored out into the ``BaseQuery`` class, since it's pretty generic functionality?