TAA-27: Implemented sorting results from database as they are return from quieries