public void removePage(BPageModel model) {
   if (model != null) {
     pageModels.remove(model.getName());
     for (BShape shape : model.getShapes()) removeShape(shape.getModel());
     model = null;
   }
 }
 /**
  * clones the datamodel doing a deep copy of the pages and shapes
  *
  * @return clone
  */
 public BDataModel clone() {
   BDataModel clone = new BDataModel();
   for (String page : this.pageModels.keySet()) {
     BPageModel pgclone = pageModels.get(page).clone();
     clone.addPage(pgclone);
     for (BShape shape : pgclone.getShapes()) {
       clone.addShape(shape.getModel());
     }
     pgclone.setData(clone);
   }
   for (String resource : this.resources.keySet()) {
     ResourceModel rmclone = resources.get(resource);
     clone.addResource(rmclone);
   }
   clone.setResourceNames(this.resourceNames);
   clone.setPageCounter(pageCounter);
   clone.setShapeCounter(shapeCounter);
   clone.documentDirectory = this.documentDirectory;
   return clone;
 }
 public void addPage(BPageModel model) {
   if (model.getName() == null) model.setName(pageCounter.getPageName());
   pageModels.put(model.getName(), model);
   model.setData(this);
 }