/// <summary>
        /// Writes the end of a child node in this <see cref="IValueWriter"/>.
        /// </summary>
        /// <param name="name">Unused by the <see cref="BinaryValueWriter"/>.</param>
        /// <exception cref="InvalidOperationException">Already at the root node.</exception>
        public void WriteEndNode(string name)
        {
            if (_nodeOffsetStack == null || _nodeOffsetStack.Count == 0)
            {
                const string errmsg = "Already at the root node.";
                throw new InvalidOperationException(errmsg);
            }

            var nodeStart  = _nodeOffsetStack.Pop();
            var nodeEnd    = _writer.PositionBits;
            var nodeLength = (uint)(nodeEnd - nodeStart - 32);

            Debug.Assert(nodeLength >= 0);

            _writer.SeekBits(nodeStart, SeekOrigin.Begin);
            Debug.Assert(_writer.PositionBits == nodeStart);

            _writer.Write(nodeLength);

            _writer.SeekBits(nodeEnd, SeekOrigin.Begin);
            Debug.Assert(_writer.PositionBits == nodeEnd);
        }