Add support for sorting results

This branch adds functionality for users to be able to send sort parameters as part of their query.