private static dynamic DeserializeObjectGraph(object graph)
{
var t = graph.GetType();
if (graph is IEnumerable<dynamic>)
{
var locGraph = graph as IEnumerable<dynamic>;
return locGraph.Select(x => DeserializeObjectGraph(x));
}
else if (graph is Dictionary<string, object>)
{
var locGraph = graph as Dictionary<string, object>;
return locGraph.ToExpando();
}
else
{
var exp = new ArgumentException();
exp.Data.Add("problem graph of type " + t, graph);
throw exp;
}
}