Change findMemberships to be an instance method

Rather than having this as a private implementation we expose the method
on the instance so we can actively find memberships when we need then.

This also has the added bonus of making the method signature simpler.
When we get rid of the pre init hook we can also drop the id argument
and just use the instance's id.
Remove skipMemberships flag and manually retrieve memberships

This doesn't entirely work currently because the memberships themselves
don't have the findMemberships method. Perhaps the best thing to do
would be to stub that method on the memberships model or similar.
Fix memberships tests
Add populateMemberships method with consistent interface

The populateMemberships method handles populating the memberships on a
model by calling the findMemberships method. This method is also added
to the Membership model as a blank implementation so that all the models
behave in the same way and no conditionals are required in app.js.
Check the _id and id fields in findMemberships method

When documents are constructed from search results they only have an
'id' field. When they are newly created they only have the '_id' field,
so we check for both.
Populate memberships in search results
Handle blank embed parameter

If the embed parameter is provided but is empty then memberships should
be skipped completely.
Fix embedded memberships in joined documents

When using the ?embed parameter to specify joins the joined documents
weren't getting their memberships added.

This change uses 'getValue', which in turn calls the mpath module to get
an array of models based on the populated path. This can also be an
array of arrays if the document is nested more than one layer deep, so
we flatten the array before processing to normalize it.
Handle errors when populating joins
Check models are valid before populating memberships

Avoid errors with possibly null models by compacting the models array to
remove falsy values and filtering the array to ensure all members have
the required method.
Match image dowload URL to API endpoint URL

The UI used to use a different URL scheme for images which was different
from the endpoint used in the API but this has now been resolved so make
them match in the API output

Also fixes PUT requests to /:collection/:id/image to return unsupported
method.

For #84