Use IdentityHashMap for attachments