Prevent circular references (for comment/feedback)

Submitted for comments, feedback for general usefulness.

For my app I had issues serializing resources that link to each other. This would cause infinite recursion.

This PR leverages the context to block resources have already been serialized.