protected function castToStdClass($value)
    {
        if (is_object($value) && !$value instanceof \stdClass) {
            $value = get_object_vars($value);
        }

        return $this->castToObject($value);
    }