public function toArray() {
        $result = iterator_to_array($this);
        foreach($result as $key => &$value) {
            if($value instanceof ArrayObject) {
                $value = $value->toArray();
            }
        }

        return $result;
    }