private void RemoveBatches(IEnumerable <Batch> batches) { if (Batches == null) { throw SheaftException.NotFound("Cette observation ne contient pas de lots."); } foreach (var batch in batches) { var observationBatch = Batches.FirstOrDefault(b => b.BatchId == batch.Id); if (observationBatch == null) { throw SheaftException.NotFound("Cette observation ne contient pas ce lot."); } Batches.Remove(observationBatch); } }