Handle node embedding, lists and circular references better in serializer