We should move this query into a new method as I believe it's done elsewhere as well.