Move image attachment data filter to model
Separate out caching to its own method.