private static object Extract(Spell spell) { if (spell == null) return null; return new { name = spell.name, tag = spell.tag, spellType = spell.GetSpellType(), location = spell.GetLocation(), superSpell = Extract(spell.GetSuperSpellParent()), activeStateList = Extract(spell.GetActiveStateList()), locationTransformName = spell.GetLocationTransformName(), powerTaskList = Extract(spell.GetPowerTaskList()), }; }