private function finish($list)
    {
        if (is_array($list) || ($list instanceof ArrayObject)) {
            foreach ($list as $index => $item) {
                $list[$index] = $this->finish($item);
            }

            if ($list instanceof ArrayObject) {
                $list = $list->getArrayCopy();
            }
        } elseif (is_object($list)) {
            $list->values = $this->finish($list->values);
        }

        return $list;
    }