public void Save(string filepath) { string path = filepath; if (String.IsNullOrEmpty(Path.GetExtension(filepath))) { path = $"{filepath}.config"; } _fileWrapper.CreateBackup(path); var fi = new FileInfo(path); string json = JsonConvert.SerializeObject(new List <VariableInfo>(_variableLookup.Values)); _fileWrapper.Write(fi.FullName, json); }