protected function validateFilename($filename, $path)
    {
        $fileParts = explode('.', $filename);
        if (count($fileParts) > 1) {
            $extension = end($fileParts);
            array_pop($fileParts);
            $fileNameWithoutExtension = implode('-', $fileParts);
            $fileNameWithoutExtension = StringUtil::slugify($fileNameWithoutExtension);
            $filename = $fileNameWithoutExtension . '.' . $extension;
        } else {
            $filename = StringUtil::slugify($filename);
        }

        if (file_exists($path . '/' . $filename)) {
            $fileParts = explode('.', $filename);
            if (count($fileParts) > 1) {
                $extension = end($fileParts);
                array_pop($fileParts);
                $fileNameWithoutExtension = implode('-', $fileParts);
                $fileNameWithoutExtension .= '-copy';
                $filename = $fileNameWithoutExtension . '.' . $extension;
            } else {
                $filename .= '-copy';
            }

            return $this->validateFilename($filename, $path);
        }

        return $filename;
    }