protected function renameFile(EntityInterface $entity, $target)
    {
        if ($entity->getFilename() && strpos($entity->getFilename(), 'tmp') !== false) {
            $filename = $entity->getFilename();
            $entity->setFilename($target.pathinfo($filename, PATHINFO_BASENAME));
            $root = $this->root.$entity->getDownloadPath().'/';
            $this->fs->copy($root.$filename, $root.$entity->getFilename(), true);
        }
    }