private Application getApplication(ApplicationId applicationId, Optional<Version> version) {
        Tenant tenant = getTenant(applicationId);
        Optional<ApplicationVersions> activeApplicationVersions = tenant.getSessionRepository().activeApplicationVersions(applicationId);
        if (activeApplicationVersions.isEmpty()) throw new NotFoundException("Unknown application id '" + applicationId + "'");

        return activeApplicationVersions.get().getForVersionOrLatest(version, clock.instant());
    }
Deletes an application and associated resources

@return true if the application was found and deleted, false if it was not present
@throws RuntimeException if deleting the application fails. This method is exception safe.
configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java