Added safeguards

- Only add the “nodeContent” key if “currentNodeContent” is not nil.
- Only add the “raw” key if “rawContent” is not nil.