String phoneNumber = record.getPhoneNumber();
if (phoneNumber == null || phoneNumber.trim().length() == 0)
return null;
phoneNumber = PhoneNumberLibrary.normalizePhoneNumber(phoneNumber);
UserIndexKey key = new UserIndexKey(UserIndexTypes.PHONE_NUMBER,
phoneNumber);
UserIndex existingUserIndex = _userService.getOrCreateUserForIndexKey(key,
"", false);
User existingUser = existingUserIndex.getUser();
String id = key.getType() + "|" + key.getValue();
UserIndexKey studyKey = new UserIndexKey("tccStudyId", id);
return _userService.addUserIndexToUser(existingUser, studyKey,
record.getSecret());
}