public static Leaf GetNextLeaf(this IBinaryNode current)
        {
            var next = current.GetNext();

            while (next != null)
            {
                if (next is Leaf leaf)
                {
                    return(leaf);
                }

                next = next.GetNext();
            }

            return(null);
        }