public void SaveToFile(String filename) { if (File.Exists(filename)) { File.Delete(filename); } DeactivateHandle(); JSONBuilder builder = new JSONBuilder(); foreach (ButtonHandle bh in handles) { builder.addAction(bh.ToAction()); } File.WriteAllText(filename, builder.toString); }