https://alexmg.dev/posts/limiting-cte-recursion-depth-in-sql-server/