public function delete($document)
    {
        $qb         = $this->dm->createQueryBuilder($this->class->name);
        $identifier = $this->uow->getDocumentIdentifier($document);

        $qb->delete();
        $qb->setIdentifier($identifier);

        if ($this->class->isLockable) {
            $qb->attr($this->class->lockMetadata->name)->exists(false);
        }

        try {
            $qb->getQuery()->execute();
        } catch (\Aws\DynamoDb\Exception\DynamoDbException $e) {
            if (
                ($this->class->isVersioned || $this->class->isLockable) &&
                $e->getAwsErrorCode() === 'ConditionalCheckFailedException'
            ) {
                throw LockException::lockFailed($document);
            }

            throw $e;
        }
    }