eachTask method maximum recursion exceeded

Hi! I want to clone a task with its sub tasks. To achieve this, I am using eachTask, and cloning all the sub tasks. However, if the levels are more than 4 or 5, I am getting “call stack size exceeded” error. Any help would be appreciated.

Hello Sumit,
I have the following sample where you can copy tasks with all their children:
I don’t have the stack exceed message even if there are 10 levels: