private function rememberFilesFactory($files, $prefix = '')
    {
        $result = [];

        foreach ($files as $key => $file) {
            $cacheKey = $prefix . (empty($prefix) ? '' : '.') . $key;
            if (is_string($file)){
                if (! $this->cache->has('_remembered_files.'.$cacheKey)){
                    continue;
                }
                /** @noinspection Annotator */
                $cached = $this->cache->get('_remembered_files.'.$cacheKey);
                if ($cached instanceof RememberedFile){
                    $result[$key] = $cached;
                }
                unset($cached);
                continue;
            }
            if (is_array($file)) {
                $result[$key] = $this->rememberFilesFactory($file, $cacheKey);
            } else {
                $storagePathName = $this->storagePath . DIRECTORY_SEPARATOR . $file->getFilename();
                copy($file->getPathname(), $storagePathName);
                $rememberedFile = new RememberedFile($storagePathName, $file);
                $this->cache->put('_remembered_files.'.$cacheKey, $rememberedFile, $this->cacheTimeout);
                $result[$key] = $rememberedFile;
            }
        }

        return $result;
    }