Fix InvalidOperationException in LookupParentFolders.

There is InvalidOperationException if we modify list (line: "list.Add (parent);") inside foreach( list ).