private void DeleteBatch(BatchDataModel batch) { BatchUtility.DeleteBatch(batch); if (CurrentBatch == batch) { int previousBatchIndex = SavedBatches.IndexOf(batch) - 1; CurrentBatch = previousBatchIndex >= 0 ? SavedBatches[previousBatchIndex] : SavedBatches.FirstOrDefault(); } SavedBatches.Remove(batch); }