added serialization of attachments