private void uninstall(PackageModel model, Map<String, DatabaseAction> associatedDatabases) {
    progress.status("Uninstallation process is running...", 1, LogLevel.INFO);
    String ofr = model.getName() + PackageFileType.PACKAGE_OFR.getDotExtension();
    try {
      InputStream stream =
          OPFEngine.FileStoreService.download(
              OpenFlame.FILESTORE_BASE,
              ofr,
              helper.getVersion(),
              model.getId().toString(),
              model.getDatabaseVersion().toString());
      InputStream xml = ArchiveUtils.getFile(stream, PackageFileType.PACKAGE_XML.getOfrFileName());
      IPackageDescriptor descriptor = packageInstallationService.getPackageDescriptor(xml);
      IOUtils.closeQuietly(xml);
      IOUtils.closeQuietly(stream);

      Map<String, List<String>> tablesMap =
          packageInstallationService.generateSQLTables(descriptor);
      int droppedDatabases = 0;
      for (Map.Entry<String, DatabaseAction> entry : associatedDatabases.entrySet()) {
        String lookup = entry.getKey();
        DatabaseAction databaseAction = entry.getValue();
        if (DatabaseActionType.DROP.equals(databaseAction.getAction())) {
          Database database = databaseAction.getDatabase();

          List<String> tables = tablesMap.get(lookup);
          if (tables != null && tables.size() != 0) {
            databaseManager.dropTables(database, tables);

            progress.status(
                "... database '" + database.getUrlPath() + "' dropping process is running",
                2,
                LogLevel.DEBUG);
            databaseManager.dropDatabase(database);
            progress.status(
                "database '" + database.getUrlPath() + "' dropping process has been finished",
                1,
                LogLevel.DEBUG);
            droppedDatabases++;
          }
        }
      }
      if (droppedDatabases > 0) {
        progress.status("all tables have been dropped.", 1, LogLevel.DEBUG);
      }
    } catch (IOException e) {
      logger.error(e.getMessage(), e);
    }
  }
  @Override
  protected void save(AudioResourceModel audioResourceModel) throws Exception {
    String temporaryUploadedFileName =
        audioResourceModel.getResourceVersion().getTemporaryFilename();

    InputStream stream =
        OPFEngine.FileStoreService.download(
            OpenFlame.FILESTORE_BASE, temporaryUploadedFileName, helper.getTemp());
    if (stream != null) {
      super.save(audioResourceModel);
      try {
        AudioResourceVersionModel audioResourceVersion = audioResourceModel.getResourceVersion();
        String audioResourceVersionFilename =
            audioResourceVersion.getId()
                + "_"
                + audioResourceVersion.getVersion()
                + "_"
                + audioResourceVersion.getCulture().name();
        OPFEngine.FileStoreService.upload(
            OpenFlame.FILESTORE_CONTENT,
            audioResourceVersionFilename,
            stream,
            helper.getAudio(),
            String.valueOf(audioResourceModel.getId()));

        resourceVersionStore.saveOrUpdate(audioResourceVersion);
        audioResourceVersion.setTemporaryFilename(null);
      } catch (Exception e) {
        logger.error(e.getMessage(), e);
      } finally {
        IOUtils.closeQuietly(stream);
      }
    } else {
      super.save(audioResourceModel);
    }
  }