public void Handler(string fileSource, string fileTarget) { logger.Write($"Start the handling: {fileSource}"); try { var text = File.ReadAllLines(fileSource).ToList(); var targetText = text.Select(t => converter.CodingMessage(t)).Where(t => !string.IsNullOrEmpty(t)).Select((t, i) => $"Case #{i}: {t}").ToList(); using (var targetFile = File.CreateText(fileTarget)){ targetText.ForEach(t => targetFile.WriteLine(t)); } } catch (Exception ex) { logger.Write(ex.Message, LogType.Error); } logger.Write($"Finished the handling: {fileSource}"); }