private Bundle installBundleFromFile(
      File savedBundleFile, boolean startBundle, boolean updateExistingBundle)
      throws IOException, BundleException {
    InputStream bundleInputStream = null;
    try {
      bundleInputStream = FileUtils.openInputStream(savedBundleFile);

      JarInformation jarInformation = new JarInformation(savedBundleFile);
      if (!isValidPluginBundle(jarInformation)) {
        LOG.warn(jarInformation.getFilename() + " is not allowed to install as add-on");
        return null;
      }
      Bundle bundle = findMatchingBundle(jarInformation);

      if (bundle == null) {
        final String bundleFileLocationAsURL = savedBundleFile.toURI().toURL().toExternalForm();
        bundle = bundleContext.installBundle(bundleFileLocationAsURL, bundleInputStream);
      } else if (updateExistingBundle) {
        LOG.info("Updating bundle " + bundle.getSymbolicName() + "|" + bundle.getVersion());
        bundle.update(bundleInputStream);
      }

      if (!isFragmentBundle(bundle) && startBundle) {
        bundle.start();
      }

      return bundle;
    } finally {
      IOUtils.closeQuietly(bundleInputStream);
    }
  }