public function update(DocumentInterface $document)
    {
        if (!$document->getId()) {
            return false;
        }

        $oldPath = $this->getPathForDocument($document->getInitialId());

        if(!file_exists($oldPath)) {
            return false;
        }

        // If the ID has changed we need to delete the old document.
        if($document->getId() !== $document->getInitialId()) {
            if(file_exists($oldPath)) {
                unlink($oldPath);
            }
        }

        return $this->store($document);
    }