✅ How to avoid stackoverflow exception in multiple recursion - C#