/// <summary> /// Create sorted file from unsorted file /// </summary> /// <param name="textFile">unsorted file</param> /// <returns>sorted file</returns> public TextFile CreateSortedTextFile(TextFile textFile) { if (textFile.DataRows == null) { return(textFile); } var nameList = _nameService.CreateNameList(textFile.DataRows); nameList = _nameService.SortedNameList(nameList); var dataRows = new List <string>(); foreach (var name in nameList) { dataRows.Add(name.GetLastNameFirstName()); } return(new TextFile { FileName = textFile.FileName + "-sorted", FilePath = textFile.FilePath, DataRows = dataRows }); }