Fix template query
Fix template query

The template `withRelated` query started failing, probably because
of the bookshelf update. It's doing a `select distinct * ...`
which doesn't work with JSON fields

synapsestudios/oidc-platform,synapsestudios/oidc-platform,synapsestudios/oidc-platform,synapsestudios/oidc-platform