private void copyTileSets(Transaction transaction) {
EntityCursor<TileSet> tileSets = tileSetsByLayer.entities(transaction, oldLayerName,
true, oldLayerName, true, null);
try {
TileSet oldTileSet;
TileSet newTileSet;
Quota oldQuota;
Quota newQuota;
TilePage oldPage;
TilePage newPage;
while (null != (oldTileSet = tileSets.next())) {
final String gridsetId = oldTileSet.getGridsetId();
final String blobFormat = oldTileSet.getBlobFormat();
final String parametersId = oldTileSet.getParametersId();
newTileSet = new TileSet(newLayerName, gridsetId, blobFormat, parametersId);
// this creates the tileset's empty used Quota too
newTileSet = getOrCreateTileSet(transaction, newTileSet);
final String oldTileSetId = oldTileSet.getId();
final String newTileSetId = newTileSet.getId();
oldQuota = usedQuotaByTileSetId
.get(transaction, oldTileSetId, LockMode.DEFAULT);
newQuota = usedQuotaByTileSetId
.get(transaction, newTileSetId, LockMode.DEFAULT);