/// <summary>
        /// Deserializes the Children of the current instance
        /// </summary>
        /// <param name="reader">the reader from which to deserialize</param>
        private void DeserializeChildren(BinaryReader reader)
        {
            if (reader.ReadByte() != 0)
            {
                Children = new DssDictionary <string, RecognizedSemanticValue>();
                int count = reader.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    string name = null;
                    RecognizedSemanticValue child = null;
                    if (reader.ReadByte() != 0)
                    {
                        name = reader.ReadString();
                    }
                    if (reader.ReadByte() != 0)
                    {
                        child = new RecognizedSemanticValue();
                        child.Deserialize(reader);
                    }
                    Children[name] = child;
                }
            }
            else
            {
                Children = null;
            }
        }
        /// <summary>
        /// Constructor that creates an instance from a SemanticValue object's
        /// internal data. The newly created instance aims to represent the same
        /// data a SemanticValue object does.
        /// </summary>
        /// <param name="keyName">The key under which this semantic value instance is
        /// referenced by its parent. Can be null for the the root value</param>
        /// <param name="semanticValue"></param>
        public RecognizedSemanticValue(string keyName, SemanticValue semanticValue)
        {
            this.KeyName    = keyName;
            this.Confidence = semanticValue.Confidence;
            this.Value      = semanticValue.Value;

            // Copy children as well
            Children = new DssDictionary <string, RecognizedSemanticValue>();
            foreach (KeyValuePair <string, SemanticValue> child in semanticValue)
            {
                Children.Add(child.Key, new RecognizedSemanticValue(child.Key, child.Value));
            }
        }