title: Filtering Data in Many To Many Relationship in Entity Framework
body: <p>I have a simple <strong>Many to Many</strong> relationship models in my project. </p>
  
  <p>Here are my classes:</p>
  
  <pre><code>public class AppUser{
     public string Id { get; set; }
     public string Name { get; set; }
  
     public List&lt;AppUserBlogs&gt; AppUserBlogs { get; set; }
  }
  </code></pre>
  
  <pre><code>public class Blog{
     public string Id { get; set;}
     public string Title { get; set;}
     public string Body { get; set;}
  
     public List&lt;AppUserBlogs&gt; AppUserBlogs { get; set; }
  }
  </code></pre>
  
  <p>Okay so what I'd like to achive in here is, I'd like to retrive all the blogs but instead the ones already a User has.</p>
  
  <p>I can do its opposite, which is retreiving list of blogs of a specific user, </p>
  
  <pre><code>public List&lt;Blog&gt; GetBlogsByUser(AppUser user)
  {
       using (var context = new BlogContext())
       {
           var blogs = context.Blogs.AsQueryable();
  
           if (!string.IsNullOrEmpty(user.Id))
           {
                 blogs =  blogs
                             .Include(i =&gt; i.AppUserBlogs)
                             .ThenInclude(i =&gt; i.AppUser)
                             .Where(i =&gt; i.AppUserChasses.Any(a =&gt; a.AppUser.Id == user.Id));
           }
  
           return blogs.ToList();
      }
  }
  </code></pre>
  
  <p>I actually need the opposite of this method. For example, lets assume that there are 20 Blogs in my Blogs Table. And 4 of them are User-1's Blogs. (BlogId-1 -> UserId-1 | BlogId-2 -> UserId-1 etc...).</p>
  
  <p>So, in another view, I'd like to show to User-1, the other 16 Blogs which User-1 doesnt have.</p>
  
  <p>I hope I did ask it clearly...</p>
  
  <p>Thank you for your time!</p>