public function listen()
    {
        $revisionsCollection = $this->getRevisionsCollection();
        $document = $this->document;

        $createRevisionCallback = function () use ($revisionsCollection, $document) {
            // create new revision
            $revisionsCollection
                ->createDocument()
                ->setDocumentData($document->getOriginalData())
                ->save();
        };

        $this->document->onBeforeUpdate($createRevisionCallback, PHP_INT_MAX);
        $this->document->onBeforeDelete($createRevisionCallback, PHP_INT_MAX);
    }