public function updateDeliveryExecutionStatus(KVDeliveryExecution $deliveryExecution, $old, $new)
    {
        $this->update($deliveryExecution);
        $userId = $deliveryExecution->getUserIdentifier();
        if ($old != null) {
            $oldReferences = $this->getDeliveryExecutionsByStatus($userId, $old);
            foreach (array_keys($oldReferences) as $key) {
                if ($oldReferences[$key]->getIdentifier() == $deliveryExecution->getIdentifier()) {
                    unset($oldReferences[$key]);
                }
            }
            $this->setDeliveryExecutions($userId, $old, $oldReferences);
        }

        $newReferences = $this->getDeliveryExecutionsByStatus($userId, $new);
        $newReferences[$deliveryExecution->getIdentifier()] = $deliveryExecution;
        return $this->setDeliveryExecutions($userId, $new, $newReferences);
    }