by setting the logicalModel variable to the logicalModelRep we would lose the removal of the mondrian file. later in this method we do this...
```
      // if associated mondrian file, delete
      if (logicalModel.getProperty("MondrianCatalogRef") != null) {
        // remove Mondrian schema
        IMondrianCatalogService service = PentahoSystem.get(IMondrianCatalogService.class, null);
        catalogRef = (String)logicalModel.getProperty("MondrianCatalogRef");
        service.removeCatalog(catalogRef, PentahoSessionHolder.getSession());
      }
```

previously we would always run this if we had an analysis model. the only time we wouldn't is if the data source was a reporting-only datasource. 
the logic you have added around switching the logicalModel based on modelState will get us into a scenario where we won't delete the mondrian models.

I think you can fix this fairly easily. We can assume that we will always have a reporting model. you can always set the logicalModelRep regardless of the modelState being null
```
LogicalModel logicalModel = model.getLogicalModel(ModelerPerspective.ANALYSIS);
if (logicalModel == null) {
  logicalModel = model.getLogicalModel(ModelerPerspective.REPORTING);
}
LogicalModel logicalModelRep = model.getLogicalModel(ModelerPerspective.REPORTING);
```


then always use that in the if block that checks for CSV
```
if ("CSV".equals(logicalModelRep.getProperty("DatasourceType")) ||
          "true".equalsIgnoreCase((String)logicalModelRep.getProperty( LogicalModel.PROPERTY_TARGET_TABLE_STAGED ))) {
```