public void ExecuteSplitOkCommand() { try { var sno = TransferItemsList.FirstOrDefault().SNO; var found = OrderItemsList.ToList().Find(x => x.SNO == sno); if (found != null) { OrderItemsList.Remove(found); } //var count = OrderItemsList.ToList().MaxBy(x => x.SNO); var items = OrderItemsList.Select(i => i.SNO).ToList(); var count = 0; if (items.Count > 0) { count = items.Max(); } foreach (var i in TransferItemsList) { count++; i.SNO = count; } foreach (var i in TransferItemsList) { var newItem = new KOTProd(i); newItem.Quantity = i.Quantity; OrderItemsList.Add(newItem); } IsSplit = false; }catch (Exception ex) { IsSplit = false; DependencyService.Get <IMessage>().ShortAlert(ex.Message); } }