Sub UnReadOnlyMap(sourceMap As Map) As Map
' copy a map to a new map to make it IsReadOnly = False
If sourceMap.IsReadOnly = False Then Return sourceMap
' the map is readonly, convert it
Dim newMap As Map
newMap.Initialize
' copy each map item
For Each key As String In sourceMap.Keys
Dim val As Object = sourceMap.Get(key)
newMap.Put(key,val)
Next
Return newMap
End Sub