Check entity framework is added, modified or deleted
<p>I'm currently looking for ways to properly check whether my entitiy framework is either added, modified or deleted. Below is my coding :</p>

<pre><code>    int state = 0;

    var added = this.ChangeTracker.Entries().Where(e =&gt; e.State == EntityState.Added).ToList();
    var modified = this.ChangeTracker.Entries().Where(e =&gt; e.State == EntityState.Modified).ToList();
    var deleted = this.ChangeTracker.Entries().Where(e =&gt; e.State == EntityState.Deleted).ToList();

        if (added.Count &gt; 0)
            state = 1;
        if (modified.Count &gt; 0)
            state = 2;
        if (deleted.Count &gt; 0)
            state = 3;
</code></pre>

<p>Currently it is working. I just want to know if there are any other proper way to do it.</p>