attachmentDataLoader

Returns a function that knows how to load an attachment.

TODO - this code together with the rest of the Attachment handling (including FetchedAttachment) needs some refactoring as it is really hard to follow.