protected function unsetNullRecursively($data, $reference = null)
    {
        if (is_null($reference)) {
            $reference = $data;
        }

        $this->loop($reference, function ($key, $value) use (&$data) {
            if (is_array($data)) {
                if (is_null($value)) {
                    unset($data[$key]);
                } else {
                    $data[$key] = $this->unsetNullRecursively($value);
                }
            }

            if (is_object($data)) {
                if (is_null($value)) {
                    unset($data->$key);
                } else {
                    $data->$key = $this->unsetNullRecursively($value);
                }
            }
        });

        return $data;
    }