class TakeSnapshotTask implements Callable<Snapshot> {

    @SuppressWarnings("unchecked")
    Collection<Contributor> collectContributors(OrganizationWrapper organization) throws IOException, URISyntaxException {
        logger.info("Started collecting contributors for organization '{}'.", organisationName);

        Collection<Contributor> contributors = new ArrayList<>();

        // Get a list of all contributors of all repositories
        Collection<GHRepository.Contributor> ghContributors = organization.listRepositories().stream()
                .map(RepositoryWrapper::listContributors)
                .flatMap(List::stream)
                .collect(toList());

        // Get a map of <Contributor ID> - <Contributions statistics>
        Map<Integer, IntSummaryStatistics> idStatisticsMap = ghContributors.stream()
                .collect(groupingBy(GHObject::getId, summarizingInt(GHRepository.Contributor::getContributions)));

        // Eliminate duplicates in contributors list
        ghContributors = ghContributors.stream()
                .collect(collectingAndThen(toCollection(() ->
                        new TreeSet<>(Comparator.comparingInt(GHObject::getId))), ArrayList::new));

        // Build a list of contributors
        for (GHRepository.Contributor ghContributor : ghContributors) {
            Contributor contributor = new Contributor(ghContributor.getId(), organization.getId(), snapshotDate);

            contributor.setName(ghContributor.getName());
            contributor.setUrl(ghContributor.getHtmlUrl().toURI().toString());
            contributor.setOrganizationalCommitsCount((int) idStatisticsMap.get(ghContributor.getId()).getSum());
            contributor.setOrganizationalProjectsCount((int) idStatisticsMap.get(ghContributor.getId()).getCount());
            contributor.setPersonalProjectsCount(ghContributor.getPublicRepoCount());
            contributor.setOrganizationName(organisationName);

            contributors.add(contributor);
        }

        // TODO contributor.setPersonalCommitsCount()

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

        return contributors;
    }

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

}