private static string GenerateBaseLayerName(string layerId, ITileSetDefinition tileSet) { Check.ArgumentNotNull(tileSet, nameof(tileSet)); Check.ArgumentNotEmpty(layerId, nameof(layerId)); int counter = 0; string prefix = ResourceIdentifier.GetName(layerId); string name = prefix; if (tileSet.LayerExists(name)) { name = prefix + counter; } while (tileSet.LayerExists(name)) { counter++; name = prefix + counter; } return(name); }