public function getQuestionDataBasedOnAnswerPositivity(?Question $question, Collection $applicants): Collection 	{ 		if (!$question) { 			return collect(); 		}  		$questionPositivity = collect(); 		$applicantIds = $applicants->pluck('id'); 		$allAnswers = $question->answers->whereIn('applicant_id', $applicantIds);  		$answerPositivities = $question->availableAnswersPositivities;  		foreach (AvailableAnswerPositivity::cases() as $positivityType) { 			$answerPositivityIndex = $answerPositivities->where('answer_positivity', $positivityType)->pluck('index')->all();  			$answers = $allAnswers->filter(function (Answer $answer, int $key) use ($answerPositivityIndex) { 				return !empty(array_intersect((array) $answer->answer_value, $answerPositivityIndex)); 			});  			$answer_array = [];  			$answers->each(function (Answer $answer) use (&$answer_array) { 				$answer_value = $answer->answer_value;  				if (is_array($answer_value)) { 					$answer_array = array_merge($answer_array, $answer_value); 				} elseif (is_numeric($answer_value)) { 					$answer_array[] = $answer_value; 				} 			});  			$available_answers = empty($question->getTranslation('available_answers', $this->locale)) ? $question->getDefaultTranslation('available_answers') : $question->getTranslation('available_answers', $this->locale);  			$merged = [];  			if ($question->type === QuestionType::CustomRadio->value && $question->class === QuestionClass::PpiDemographic) { 				$question->questionAnswerGroups->each(function (QuestionAnswerGroup $questionAnswerGroups) use (&$merged, &$answer_array) { 					foreach ($answer_array as $index => $answer) { 						if (in_array($answer, $questionAnswerGroups->grouped_values)) { 							$merged[$questionAnswerGroups->getTranslation('title', $this->locale)] = isset($merged[$questionAnswerGroups->getTranslation('title', $this->locale)]) ? ++$merged[$questionAnswerGroups->getTranslation('title', $this->locale)] : 1; 							unset($answer_array[$index]); 						} 					} 				}); 			}  			$counted_answers_array = array_count_values($answer_array); 			$counted_answers_array = array_intersect_key($counted_answers_array, array_flip($answerPositivityIndex));  			$counted_answers_array = collect($counted_answers_array);  			$translated_counted_array = [];  			$counted_answers_array->map(function (int $value, int $key) use ($available_answers, &$translated_counted_array) { 				$translated_key = $available_answers[$key - 1] ?? ($key);  				$translated_counted_array[$translated_key] = $value; 			});  			$merged = array_merge($merged, $translated_counted_array);  			arsort($merged);  			$merged = collect($merged);  			$questionPositivity->put(__('questions.answer-positivities.' . $positivityType->value), collect( 				[ 					'title' => $question->getTranslation('title', $this->locale), 					'positivityType' => $positivityType->value, 					'data' => $merged, 				] 			)); 		}  		return $questionPositivity; 	}