protected function sortObject($object)
    {
        $sort_array = get_object_vars($object);
        ksort($sort_array);

        $new_object = new stdClass();
        foreach ($sort_array as $key => $value) {
            if (is_object($value)) {
                $value = $this->sortObject($value);
            }
            $new_object->$key = $value;
        }

        unset($sort_array);
        unset($object);

        return $new_object;
    }