Update Attachment related codes to pass some of AttachmentsTests