private void copyOne(Catalog catalog, final CatalogInfo original,
final Class<CatalogInfo> clazz, final LayerInfo layer, final String nameSuffix,
final Stopwatch sw) {
CatalogInfo prototype = prototype(original, catalog);
try {
OwsUtils.set(prototype, "id", null);
OwsUtils.copy(clazz.cast(original), clazz.cast(prototype), clazz);
final String newName = OwsUtils.get(prototype, "name") + nameSuffix;
OwsUtils.set(prototype, "name", newName);
if (prototype instanceof WorkspaceInfo) {
sw.start();
catalog.add((WorkspaceInfo) prototype);
sw.stop();
String originalWsName = ((WorkspaceInfo) original).getName();
NamespaceInfo ns = catalog.getNamespaceByPrefix(originalWsName);
NamespaceInfoImpl ns2 = new NamespaceInfoImpl();
ns2.setPrefix(newName);
ns2.setURI(ns.getURI() + newName);
sw.start();
catalog.add(ns2);
sw.stop();
} else if (prototype instanceof StoreInfo) {
sw.start();
catalog.add((StoreInfo) prototype);
sw.stop();
} else if (prototype instanceof ResourceInfo) {
((ResourceInfo) prototype).setNativeName(((ResourceInfo) original).getNativeName());
((ResourceInfo) prototype).setName(newName);
sw.start();
catalog.add((ResourceInfo) prototype);
sw.stop();
String id = prototype.getId();
// prototype = catalog.getResource(id, ResourceInfo.class);
if (layer == null) {
return;
}