//Subject.id == 0 then is registration or case insensitive check and subject update.
if (subject.getId() == 0) {
//i)case insensitive check or ii)ldap new user registration.
//BZ-586435: insert case insensitivity for usernames with ldap auth
// locate first matching subject and attach.
SubjectCriteria subjectCriteria = new SubjectCriteria();
subjectCriteria.setCaseSensitive(false);
subjectCriteria.setStrict(true);
subjectCriteria.fetchRoles(false);
subjectCriteria.fetchConfiguration(false);
subjectCriteria.addFilterName(subject.getName());
//BZ-798465: spinder 3/1/12 we now need to pass in overlord because of BZ-786159
// We've verified that this user has valid session, and is using ldap. Safe to elevate search here.
PageList<Subject> subjectsLocated = findSubjectsByCriteria(getOverlord(), subjectCriteria);
//if subject variants located then take the first one with a principal otherwise do nothing
//To defend against the case where they create an account with the same name but not