complete the update function include the attachment