public void SaveSession() { Debug.Assert(!string.IsNullOrEmpty(_sessionViewModel.FileName)); var name = _sessionViewModel.FileName; using (var writer = new StreamWriter(name, false, Encoding.UTF8)) { SaveSession(writer); } _sessionViewModel.AddRecentlyUsedFile(name); }