Makes sense that we want to terminate on no parent rather than just if reach an app

But is this fixing when there's an app inside an app?

Or if there's an entity that does not have an app at the very top of its hierarchy? For the latter, we're not going into the loop with the root of the tree so it won't add the root to resultM. We get away with this for top-level apps because earlier in the method we added all of mgmt().getApplications().