public function createUniqueFileName($file)
    {
        $ext = '.'.$file->guessExtension();
        $basename = trim(str_replace('.'.$file->getClientOriginalExtension(), '', $file->getClientOriginalName()));
        $basename = str_replace(' ', '-', $basename);
        $basename = strtolower($basename);

        $existing = $this->filesystem->listKeys($basename);
        if (isset($existing['keys'])) {
            $existing = $existing['keys'];
        }

        if (count($existing)) {
            $ids = [1];
            foreach ($existing as $neighbor) {
                $neighbor = str_replace($ext, '', $neighbor);
                if (preg_match('/(\d+)$/', $neighbor, $matches)) {
                    $ids[] = intval($matches[1]);
                }
            }

            rsort($ids);
            $id = reset($ids);
            ++$id;

            $basename = $basename.'-'.$id;
        }

        return $basename.$ext;
    }