Improve attachments factories and fix tests related to storage refactor.