protected function castObject($value)
    {
        if ($value instanceof \DateTime) {
            return $value->format('c');
        }
        
        if (method_exists($value, '__toString')) {
            return (string)$value;
        }
        
        return $this->dontCast($value);
    }