code: protected Candidate checkForDuplicates(Candidate candidate) {
          if (candidate == null || candidate.getId() != null) {
              return candidate;
          }
  
          String email = candidate.getEmail();
          String firstName = candidate.getFirstName();
          String lastName = candidate.getLastName();
  
          if (!StringUtils.isEmpty(firstName) && !StringUtils.isEmpty(lastName) && !StringUtils.isEmpty(email)) {
  
              StringBuilder query = new StringBuilder();
  
              query.append("isDeleted:0");
  
              query.append(" AND firstName:" + firstName);
              query.append(" AND lastName:" + lastName);
              query.append(" AND email:" + email);
              query.append(" NOT status:Archive");
              SearchParams params = ParamFactory.searchParams();
              params.setCount(1);
  
              List<Candidate> candidateSearch = this.searchForList(Candidate.class, query.toString(), null, params);
  
              if (candidateSearch != null && candidateSearch.size() > 0) {
                  return candidateSearch.get(0);
              }
          }
  
          return candidate;
      }
docs: Runs a search query on firstName, lastName and email to find possible candidate duplicate. If a duplicate exists that candidate is
  returned.
  <p>
  If the passed in candidate already has an id the duplicate check is never run and the passed in candidate is returned without any
  changes made to it.
  
  @param candidate
  @return