Make updateAttachments more transactional