public void saveWordPairsFromList(string fileName, string profile, listManager LM) { if (profile != null && (profile.Length > 0 && fileName.Length > 0)) { if (doesFileExist(fileName, profile)) { string filePath = this.folderLocation + profile + "/" + fileName; foreach (pairWords PW in LM.getList()) { this.addToContent(PW.getPairTogetherString()); } File.WriteAllLines(@filePath, this.fileContents.ToArray()); } else { MessageBox.Show("File doesn't exists. Try to recreate file list."); } } else { MessageBox.Show("Invalid profile name or file name."); } }