public function setPublishDate($time)
    {
        if ($time === null || $time === '') {
            $this->publishDate = null;
            return $this;
        }

        if (is_string($time)) {
            try {
                $time = new DateTime($time);
            } catch (Exception $e) {
                throw new UnexpectedValueException(sprintf(
                    'Invalid Publication Date: %s',
                    $e->getMessage()
                ), $e->getCode(), $e);
            }
        }

        if (!$time instanceof DateTimeInterface) {
            throw new InvalidArgumentException(
                'Publication Date must be a date/time string or an instance of DateTimeInterface'
            );
        }

        $this->publishDate = $time;

        return $this;
    }