public function compact(){

        $array_filter_rec = function($input, $callback = null) use (&$array_filter_rec) {
            foreach ($input as &$value) {
                if (is_array($value)) {
                    $value = $array_filter_rec($value, $callback);
                }
            }
            return array_filter($input, $callback);
        };

        $this->fields = $array_filter_rec($this->fields,function($a){ return $a !== null; });
    }