protected Person addNewSorPersonAndLinkWithMatchedCalculatedPerson(
      final ReconciliationCriteria reconciliationCriteria, final ReconciliationResult result)
      throws SorPersonAlreadyExistsException {
    Assert.isTrue(
        result.getMatches().size() == 1,
        "ReconciliationResult should be 'EXACT' and there should only be one person.  The result is '"
            + result.getReconciliationType()
            + "' and the number of people is "
            + result.getMatches().size()
            + ".");

    final Person person = result.getMatches().iterator().next().getPerson();
    return addSorPersonAndLink(reconciliationCriteria, person);
  }
  public ServiceExecutionResult<Person> addPersonAndLink(
      final ReconciliationCriteria reconciliationCriteria, final Person person)
      throws IllegalArgumentException, IllegalStateException, SorPersonAlreadyExistsException {
    Assert.notNull(reconciliationCriteria, "reconciliationCriteria cannot be null.");
    Assert.notNull(person, "person cannot be null.");
    logger.info(" addPersonAndLink start");
    final ReconciliationResult result = this.criteriaCache.get(reconciliationCriteria);

    if (result == null) {
      throw new IllegalStateException("No ReconciliationResult found for provided criteria.");
    }

    for (final PersonMatch personMatch : result.getMatches()) {
      if (personMatch.getPerson().getId().equals(person.getId())) {
        addSorPersonAndLink(reconciliationCriteria, person);
        final Person savedPerson = this.personRepository.findByInternalId(person.getId());
        return new GeneralServiceExecutionResult<Person>(savedPerson);
      }
    }
    logger.info("addPersonAndLink end");
    throw new IllegalStateException("Person not found in ReconciliationResult.");
  }