code: private int processCommits(GitHubRepo repo) {
          int count = 0;
          Long existingCount = commitRepository.countCommitsByCollectorItemId(repo.getId());
          if (existingCount == 0) {
              List<Commit> newCommits = gitHubClient.getCommits();
              newCommits.forEach(c -> c.setCollectorItemId(repo.getId()));
              Iterable<Commit> saved = commitRepository.save(newCommits);
              count = saved != null ? Lists.newArrayList(saved).size() : 0;
          } else {
              Collection<Commit> nonDupCommits = gitHubClient.getCommits().stream()
                      .<Map<String, Commit>> collect(HashMap::new,(m,c)->m.put(c.getScmRevisionNumber(), c), Map::putAll)
                      .values();
              for (Commit commit : nonDupCommits) {
                  LOG.debug(commit.getTimestamp() + ":::" + commit.getScmCommitLog());
                  if (isNewCommit(repo, commit)) {
                      commit.setCollectorItemId(repo.getId());
                      commitRepository.save(commit);
                      count++;
                  }
              }
          }
          LOG.info("-- Saved Commits = " + count);
          return count;
      }
docs: Process commits
  
  @param repo
  @return count added