Work on improving performance of fetching records with many related records.

To do this, we've changed the API of our models.  The `sequel_to_json'
method now takes an array of objects as its first argument, rather than
just one.  This allows our model mixins to work on sets of records,
pulling back multiple associated records from the database in one go.

We've also rewritten the resolver to utilise this new feature, so
resolving a record's linked records can now be done much more
efficiently--the time taken should now be proportional to the number of
different types of linked records, rather than the number of linked
records.