function removeNull(array $array, $translator = '')
{
$temp = [];
foreach ($array as $key => $value) {
if (is_array($value)) {
$value = removeNull($value, $translator);
}
if (is_object($value)) {
$value = removeNull($value->toArray(), $translator);
}
$temp[$key] = null === $value ? $translator : $value;
}
return $temp;
}