class TakeSnapshotTask implements Callable<Snapshot> {

    @SuppressWarnings("rawtypes")
    Collection<Language> collectLanguages(OrganizationWrapper organization) {
        logger.info("Started collecting languages for organization '{}'.", organisationName);

        Collection<Language> languages = new ArrayList<>();

        Map<String, LongSummaryStatistics> stat = organization.listRepositories().stream()
                .map(RepositoryWrapper::listLanguages)
                .map(Map::entrySet)
                .flatMap(Set::stream)
                .collect(groupingBy(Map.Entry::getKey,
                        summarizingLong(entry -> ((Number) ((Map.Entry) entry).getValue()).longValue())));

        final long allLanguageSize = stat.entrySet().stream()
                .map(entry -> entry.getValue().getSum())
                .reduce(0L, Long::sum);

        for (Map.Entry<String, LongSummaryStatistics> entry : stat.entrySet()) {
            Language language = new Language();

            language.setName(entry.getKey());
            language.setProjectsCount((int) entry.getValue().getCount());
            language.setPercentage((int) (entry.getValue().getSum() * 100 / allLanguageSize));

            languages.add(language);
        }

        logger.info("Finished collecting languages for organization '{}'.", organisationName);

        return languages;
    }

    public  TakeSnapshotTask(final GitHub gitHub, final String organisationName, Scorer scorer, Date snapshotDate);

}