parse attachments recursively