public function updateDeliveryExecutionState($identifier, $fromState, $toState)
    {
        try {
            if ($fromState === $toState) {
                // do nothing, when the state didn't change
                return true;
            }

            $query = $this->getQueryBuilder()
                ->update(self::TABLE_NAME)
                ->set(self::COLUMN_STATUS, ":status")
                ->where(self::COLUMN_ID . " = :id")
                ->setParameter("status", $toState)
                ->setParameter("id", $identifier)
            ;

            if ($toState === DeliveryExecutionInterface::STATE_FINISHED) {
                $query
                    ->set(self::COLUMN_FINISHED_AT, ":finishedAt")
                    ->setParameter("finishedAt", $this->getCurrentDateTime())
                ;
            }

            return $query->execute() === 1;
        } catch (\Exception $e) {
            return false;
        }

    }