protected function removeNullValuesFromArray($array)
    {
        $result = [];

        foreach ($array as $key => $value) {
            if (isset($value)) {
                if (($value instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage && count($value) > 0) || !($value instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage)) {
                    $result[$key] = $value;
                }
            }
        }

        return $result;
    }