protected function updateTicket(TicketMessageInterface $message)
    {
        $ticket = $message->getTicket()->setUpdatedAt(new \DateTime());

        if ($message->isLatest() && ($ticket->getState() !== TicketStates::STATE_CLOSED)) {
            if ($message->isCustomer()) {
                if ($ticket->getState() === TicketStates::STATE_PENDING) {
                    $ticket->setState(TicketStates::STATE_OPENED);
                }
            } elseif ($ticket->getState() === TicketStates::STATE_OPENED) {
                $ticket->setState(TicketStates::STATE_PENDING);
            }
        }

        $this->persistenceHelper->persistAndRecompute($ticket, false);
    }