public static void ToFile(this IpResult model, string path) { if (model == null) { throw new ArgumentNullException("The model is null."); } using (var writer = new StreamWriter(path, append: true, encoding: Encoding.UTF8)) { writer.Write(model.ToDisplay()); writer.Flush(); writer.Close(); } }