Added an toPaginatedArray method to the Query class.