private Names lookupName(NamesDAO namesDao, NameComplexType nameFromImport)
      throws IllegalAccessException, InvocationTargetException, UnknownLookupListException,
          PersistenceException, NoSuchAlgorithmException, UnsupportedEncodingException {
    Names name = new Names();
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_NAME_TYPE, nameFromImport.getNameType());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_SORT_NAME, nameFromImport.getSortName());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_NAME_RULE, nameFromImport.getNameRule());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_NUMBER, nameFromImport.getNumber());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_QUALIFIER, nameFromImport.getQualifier());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_DESCRIPTION_TYPE, nameFromImport.getDescriptionType());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_DESCRIPTION_NOTE, nameFromImport.getDescriptionNote());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_CITATION, nameFromImport.getCitation());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_SALUTATION, nameFromImport.getSalutation());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_CONTACT_ADDRESS_1, nameFromImport.getContactAddress1());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_CONTACT_ADDRESS_2, nameFromImport.getContactAddress2());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_CONTACT_CITY, nameFromImport.getContactCity());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_CONTACT_REGION, nameFromImport.getContactRegion());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_CONTACT_COUNTRY, nameFromImport.getContactCountry());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_CONTACT_MAIL_CODE, nameFromImport.getContactMailCode());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_CONTACT_PHONE, nameFromImport.getContactPhone());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_CONTACT_FAX, nameFromImport.getContactFax());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_CONTACT_EMAIL, nameFromImport.getContactEmail());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_CONTACT_NAME, nameFromImport.getContactName());
    ImportUtils.nullSafeSet(name, Names.PROPERTYNAME_FAMILY_NAME, nameFromImport.getFamilyName());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_FAMILY_NAME_PREFIX, nameFromImport.getFamilyNamePrefix());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_CORPORATE_PRIMARY_NAME, nameFromImport.getCorporatePrimaryName());
    ImportUtils.nullSafeSet(
        name,
        Names.PROPERTYNAME_CORPORATE_SUBORDINATE_1,
        nameFromImport.getCorporateSubordinate1());
    ImportUtils.nullSafeSet(
        name,
        Names.PROPERTYNAME_CORPORATE_SUBORDINATE_2,
        nameFromImport.getCorporateSubordinate2());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_PERSONAL_PRIMARY_NAME, nameFromImport.getPersonalPrimaryName());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_PERSONAL_REST_OF_NAME, nameFromImport.getPersonalRestOfName());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_PERSONAL_PREFIX, nameFromImport.getPersonalPrefix());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_PERSONAL_SUFFIX, nameFromImport.getPersonalSuffix());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_PERSONAL_FULLER_FORM, nameFromImport.getPersonalFullerForm());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_PERSONAL_TITLE, nameFromImport.getPersonalTitle());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_PERSONAL_DATES, nameFromImport.getPersonalDates());
    ImportUtils.nullSafeSet(
        name, Names.PROPERTYNAME_PERSONAL_DIRECT_ORDER, nameFromImport.isPersonalDirectOrder());
    if (nameFromImport.getNameSource() == null) {
      name.setNameSource("ingest");
    } else {
      name.setNameSource(nameFromImport.getNameSource());
    }
    if (name.getSortName() == null || name.getSortName().length() == 0) {
      name.createSortName();

      // check to see if sort name is still empty. If so, set it to " " so that
      // this record can be inserted into an Oracle DB without throwing an error
      if (name.getSortName().length() == 0) {
        name.setSortName(" ");
      }
    }
    NameUtils.setMd5Hash(name);

    return namesDao.lookupName(name, true);
  }