void (@NotNull Object payload) { Deque<ExternalSystemNode<?>> toProcess = new ArrayDeque<>(); toProcess.addFirst(getRoot()); while (!toProcess.isEmpty()) { ExternalSystemNode<?> node = toProcess.removeLast(); if (payload.equals(node.getDescriptor().getElement())) { removeNodeFromParent(node); } else { for (int i = 0; i < node.getChildCount(); i++) { toProcess.addFirst(node.getChildAt(i)); } } } }