added logic for duplicate emails and loginIds