public static void SaveToMap( [NotNull] this MapGeneratorParameters mapGenParams, [NotNull] Map map ) {
if( mapGenParams == null ) {
throw new ArgumentNullException( "mapGenParams" );
}
if( map == null ) {
throw new ArgumentNullException( "map" );
}
XElement el = new XElement( ParamsMetaKey );
mapGenParams.Save( el );
map.Metadata[ParamsMetaGroup, ParamsMetaKey] = el.ToString( SaveOptions.DisableFormatting );
map.Metadata[ParamsMetaGroup, GenNameMetaKey] = mapGenParams.Generator.Name;
map.Metadata[ParamsMetaGroup, GenVersionMetaKey] = mapGenParams.Generator.Version.ToString();
}