I had implemented an ActionFilter, that logs all my actions to a table.

My current approach:

Action
------

```
using (var scope = context.Database.BeginTransaction())
{
   try
   {
       //some code
       context.SaveChanges();
       scope.Commit();  
   }
   catch (Exception ex)
   {
      scope.Rollback();
      throw ex; 
   }
}

```

Filter
------

```
...
dbSet.Add(mylog);
context.SaveChanges();

```

Problem
-------

When any error occurs inside "some code" in action, the entities changed inside this code will be saved to database when ActionFilter executes its "SaveChanges". So, the Rollback is doing nothing.

How make ActionFilter "see" only changes for entities it changes?

WHat's the best approach?