private void grid_Friends_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!LoadedProfile) { return; } if (!ChangedElements.HasFlag(Changed.Friends)) { ChangedElements |= Changed.Friends; } Task.Run(async() => { currentProfile.Friends.Friend.Clear(); foreach (DataGridViewRow row in grid_Friends.Rows) { currentProfile.Friends.Friend.Add(new UOS.XML.Profile.Friend() { Text = row.Cells[0].Value.ToString(), Name = row.Cells[1].Value.ToString() }); } }); }