Fix assumption about Attachment.AttachmentType being set