public function generateDtoWithFilteredClientSurveys(ClientSurvey $base_client_survey, Collection $client_surveys, GetComparativeReport $request, string $locale): void 	{ 		$enps_service = new IzzPdfEnpsCalculationService; 		$engagement_service = new IzzPdfEngagementCalculationService; 		$client_survey_with_applicants_exists = false; 		$surveys_with_categories_data = collect(); 		$surveys_categories_all_data = collect(); 		$enps_all_surveys = []; 		$engagement_all_surveys = []; 		$esi_all_surveys = [];  		$client_surveys->each(function (ClientSurvey $client_survey) use (&$surveys_categories_all_data, &$request, &$locale, &$enps_service, &$engagement_service, &$surveys_with_categories_data, &$enps_all_surveys, &$engagement_all_surveys, &$client_survey_with_applicants_exists, &$esi_all_surveys): void { 			$client_survey->load(['applicants' => function ($query) use ($request, $client_survey) { 				$query 					->available() 					->final() 					->filterByAnswers($request->comparative_surveys_filter[$client_survey->getKey()]['comparative_filter_values'] ?? null) 					->filterByLocationAndDepartment($request->comparative_surveys_filter[$client_survey->getKey()]['comparative_locations'] ?? null, $request->comparative_surveys_filter[$client_survey->getKey()]['comparative_departments'] ?? null); 			}]);  			$categories_data = $this->getCategoriesAverageScore($client_survey, $client_survey->survey->categories, $locale, $client_survey->applicants->pluck('id')->all());  			// SURVEYS BY YEAR 			$average_score = array_sum(array_column($categories_data, 'score')) / count($categories_data);  			if ($average_score > 0) { 				$client_survey_with_applicants_exists = true;  				$surveys_with_categories_data->push(['key' => $client_survey->getKey(), 'category_data' => $categories_data, 'average_score' => $average_score]);  				$surveys_categories_all_data->push($categories_data);  				// ENGAGEMENT 				$engagement_percentage_data = $engagement_service->calculateApplicantEngagementPercentages($client_survey); 				array_push($engagement_all_surveys, [ 					'client_survey_id' => $client_survey->getKey(), 					'year' => $client_survey->survey->year, 					'data' => $engagement_percentage_data, 				]);  				// ENPS 				$enps_score = $enps_service->calculateEnpsGrade($client_survey); 				$enps_percentage_data = $enps_service->calculatePercentageDataForEnpsGradeCalculation($client_survey); 				array_push($enps_all_surveys, [ 					'client_survey_id' => $client_survey->getKey(), 					'year' => $client_survey->survey->year, 					'enps_score' => $enps_score, 					'enps_percentage_data' => $enps_percentage_data, 				]);  				// ESI 				$esiObject = App::make(EsiMetrics::class)->generate($client_survey->getApplicants());  				array_push($esi_all_surveys, [ 					'client_survey_id' => $client_survey->getKey(), 					'year' => $client_survey->survey->year, 					'year_average' => $esiObject->getEsiTotal(), 					'esi_workplace_expectations' => $esiObject->getWorkplaceExpectations()->getAverage(), 					'esi_workplace_satisfaction' => $esiObject->getWorkplaceSatisfaction()->getAverage(), 					'esi_ideal_job_comparison' => $esiObject->getIdealJobComparison()->getAverage(),  				]); 			} 		});  		// sync current (year) client survey categories with diffrent (by code) categories from previous years 		$all_client_survey_categories = $this->getCurrentAndOldClientSurvysCategoriesData($surveys_with_categories_data, $base_client_survey);  		$all_categories_last_page_data = $this->getCategoriesLastPageData($surveys_categories_all_data, $all_client_survey_categories);  		$this->prepareComparativeDataObject($client_surveys, $request, $locale, $all_client_survey_categories, $surveys_with_categories_data, $engagement_all_surveys, $enps_all_surveys, $all_categories_last_page_data, $client_survey_with_applicants_exists, $esi_all_surveys); 	}