switch out recursive dfs for stack based approach, to avoid possibly hitting the recursion limit
Merge pull request #3171 from ClipCard/master

Prevent possible recursion limit issue in migration planning