private void UsersGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (UsersGridView.GetRow(e.RowHandle) is Users user) { if (user.IsSelectedUserInDocuments) { userIds.Add(user.Id); } else { userIds.Remove(user.Id); } } }