Since raw attributes and raw document are pretty much the same I think you can replace these parts for raw document rather than attributes