Use custom query instead of ORM syntax to maintain correct ordering