Fix to sort queries and retrieve everything

The query sorting is a bit primitive. Should probably allow each EntityProvider to define their own ordering