add saveAttachment method