Update Attachment related code to pass basic attachment test cases