Add a `Query` object for abstracting AR relations

This adds a `Query` object that wraps an AR relation and provides
convenience methods for working with the relation. It allows
retrieving the models, wrapping the records returned from the
relation. It also provides methods for counting the number of
items the query would return. Finally, it also provides the
ability to page the query. This provides the logic to page using
AR and provides convenience methods for getting the count,
total count and total pages. All of this is intented to provide
a tool for handling queries without having to expose the record
or AR relation outside the model.