code: function validateThemeNotInUseByApps(cb) {
      var appThemeModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_THEMES);
  
      appThemeModel.count({"theme" : options._id}, function(err, countAppsUsingTheme) {
        if (err) {
          return cb(err);
        }
  
        if (countAppsUsingTheme > 0) {
          return cb(new Error("Cannot delete theme in use by apps. Apps Using this theme" + countAppsUsingTheme));
        }
  
        return cb();
      });
    }
docs: Themes associated with app should not be deleted.