protected function convertArrayObjects($data)
    {
        if ($data instanceof Json\ArrayObject) {
            // @todo: Check if we need to convert arrays with only one single
            // element into non-arrays /cc cba
            $data = $data->getArrayCopy();
            foreach ($data as $key => $value) {
                $data[$key] = $this->convertArrayObjects($value);
            }
        } elseif ($data instanceof Json\JsonObject) {
            foreach ($data as $key => $value) {
                $data->$key = $this->convertArrayObjects($value);
            }
        }

        return $data;
    }