Please add some some unit test for this method covering several cases as it can be a bit dangerous if it the recursion goes on forever.