protected function markProcessed(ImapAdapter $imap, $id, Message $message = null)
    {
        $flags   = $message ? $message->getFlags() : [];
        $flags[] = self::PROCESSED_FLAG;

        try {
            $imap->setFlags($id, $flags);
        } catch (ExceptionInterface $e) {
            // Nothing to do
        }
    }