How to make a foreach loop skip the item upon exception?

```
foreach (var item in items) 
{
   newItems.Add(new object
   {
      Name = item.name,
      Category= GetCategoryByName(item.name),
      AddedTime= DateTime.Now
   });
}

```

Let's say that in my List of items, I got 1000 objects,
Each time I create a new object, I call for a function that looks up in a list and retrieves the categoryName by doing

```
private string GetCategoryByName (string name) 
{
   return CategoryList.Where( n=> n == name).First();
}

```

But it happens that the name doesn't exist in the Category list, which will cause an exception that no sequence match e.g. 

What I wonder then is how can I just skip this item that doesn't exist in the category list? What I would like to do is to log the Name that doesn't exist in the CategoryList and continue to the next item. It feels like when the exception occurs on f.eks item with index 600, it just stops there and exits the foreach loop, with only 599/600 items. When it should continue and end up with 999 items (since one caused exception).

How can I fix this? I want to log and ignore all the items that causes exception due non-existent categoryname when looking up in the category list.