/// <summary>
 /// Serialized a map. The default implementation first ensure that the value is indeed a map and then uses
 /// GetMapSize() and GetMapElements() to access the contents of the map.
 /// </summary>
 /// <param name="schema">The MapSchema for serialization</param>
 /// <param name="value">The value to be serialized</param>
 /// <param name="encoder">The encoder for serialization</param>
 protected void WriteMap(WriteItem itemWriter, object value, Encoder encoder)
 {
     _mapAccess.EnsureMapObject(value);
     encoder.WriteMapStart();
     encoder.SetItemCount(_mapAccess.GetMapSize(value));
     _mapAccess.WriteMapValues(value, itemWriter, encoder);
     encoder.WriteMapEnd();
 }