public function handleApplicantCodesIfMultipleCodesBooleanChanged(ClientSurvey $client_survey, ?string $single_code = null): void 	{ 		$applicants = $client_survey->applicants;  		// If true, some codes are unique and some arent OR they may all be equal 		// Next check if they should all be unique or not 		if (count($applicants) !== count(array_flip($applicants->pluck('code')->all()))) { 			if ($single_code) { 				foreach ($applicants as $applicant) { 					$applicant->update([ 						'code' => $single_code, 					]); 				} 			} else { 				$applicants_with_duplicate_codes = $applicants->groupBy('code')->map->count()->all(); 				$codes_filter = array_keys(array_filter($applicants_with_duplicate_codes, function ($value) { 					return $value > 1; 				}));  				foreach ($applicants->whereIn('code', $codes_filter) as $applicant) { 					$code = Applicant::generateCode(); 					$applicant->update([ 						'code' => $code, 					]); 				} 			} 		} elseif ($single_code) { 			foreach ($applicants as $applicant) { 				$applicant->update([ 					'code' => $single_code, 				]); 			} 		} 	}