Refactor foreach statement to LINQ
LINQ isn't a silver bullet. It stands for Language-INtegrated-Query, which allows querying objects.

Querying objects isn't something that's supposed to have side-effects. However this is precisely what you loop's body is doing.

Therefore, refactoring it to use LINQ, if at all possible, would make it much less readable than the foreach loop you have here.

You could always create a Task object for each notification, and then run that.



Now the loop body you have, is using AddRange to add what appears to be a single value. Unless notification.ID is an IEnumerable&lt;whatever&gt;, you should be using the Add method to add a single value to your successNotificationIDs.