Persist attachments in sqlite database