private Release getLatestRelease(Repository repository) throws IOException {
        Release latestRelease = null;
        for (Release release : getReleases(repository)) {
            if (latestRelease == null || release.getPublishedAt().after(latestRelease.getPublishedAt())) {
                latestRelease = release;
            }
        }
        
        if (latestRelease != null 
                && repoReleaseDates.containsKey(repository.getName()) 
                && latestRelease.getPublishedAt().after(repoReleaseDates.get(repository.getName()))) {
            
            // Latest release is newer than the last one we saw. Clear file data cache.
            clearFileCache(repository.getName());
        }
        return latestRelease;
    }