@Override
  public boolean isCompatible(Version version) {
    boolean compatible = true;

    if (getVersion() == null) {
      compatible = containsVersion(version);
    } else {
      compatible = version.compareTo(getVersion()) >= 0;
    }

    return compatible;
  }
  protected InstalledExtension checkAlreadyInstalledExtension(
      String id, Version version, String namespace) throws ResolveException, InstallException {
    InstalledExtension installedExtension =
        this.installedExtensionRepository.getInstalledExtension(id, namespace);
    if (installedExtension != null) {
      if (getRequest().isVerbose()) {
        this.logger.debug(
            "Found already installed extension with id [{}]. Checking compatibility...", id);
      }

      if (version == null) {
        throw new InstallException(
            String.format("The extension with id [%s] is already installed", id));
      }

      int versionDiff = version.compareTo(installedExtension.getId().getVersion());

      if (versionDiff == 0) {
        throw new InstallException(
            String.format("The extension [%s-%s] is already installed", id, version));
      } else {
        // Change version
        InstalledExtension previousExtension = installedExtension;

        // Make sure the new version is compatible with old version backward dependencies
        if (installedExtension.isInstalled(null)) {
          Map<String, Collection<InstalledExtension>> backwardDependencies =
              this.installedExtensionRepository.getBackwardDependencies(installedExtension.getId());

          if (!isCompatible(backwardDependencies.get(null), id, version)) {
            throw new InstallException(
                String.format(
                    "The extension [%s-%s] is not compatible with previous version ([%s]) backward dependencies",
                    id, version, installedExtension.getId()));
          }

          if (namespace != null) {
            if (!isCompatible(backwardDependencies.get(namespace), id, version)) {
              throw new InstallException(
                  String.format(
                      "The extension [%s-%s] is not compatible with previous version ([%s]) backward dependencies on namespace [%s]",
                      id, version, installedExtension.getId(), namespace));
            }
          }
        } else {
          Collection<InstalledExtension> backwardDependencies =
              this.installedExtensionRepository.getBackwardDependencies(
                  installedExtension.getId().getId(), namespace);

          if (!isCompatible(backwardDependencies, id, version)) {
            throw new InstallException(
                String.format(
                    "The extension [%s-%s] is not compatible with previous version ([%s]) backward dependencies on namespace [%s]",
                    id, version, installedExtension.getId(), namespace));
          }
        }

        return previousExtension;
      }
    }

    return null;
  }