Your problem seems to lie here:
Does this method return an
? Or does it return a
? If it returns an object, then you need to convert that object into a Dictionary, so that you can iterate the collection using ForEach. Otherwise you need to declare the result of the method as a Dictionary and not an object.
Hope this helps