title: Updating foreign key on soft delete
body: <p>I have 2 rows in my database.
  <code>Category</code> and <code>Movie</code>.</p>
  
  <p>When I'm soft deleting <code>Movie</code>, I want to remove the FK reference to <code>Category</code>.</p>
  
  <p>I have a delete method that looks like this:</p>
  
  <pre><code>        public override async Task DeleteAsync(long id, bool permanent = false)
          {
              await DbFactory.ExecAsync(async (db) =&gt;
              {
                  if (permanent)
                  {
  
                      await db.DeleteAsync&lt;Movie&gt;(x =&gt; x.Id == id);
                  }
                  else
                  {
                      await db.UpdateAsync&lt;Movie&gt;(new { Deleted = true, CategoryId = 0 }, x =&gt; x.Id == id);
                  }
              });
          }
  </code></pre>
  
  <p>But it throws an FK exception when I'm trying to update the <code>CategoryId</code></p>
  
  <p>How can I do this?
  I want to be able to soft delete a <code>Movie</code>, and then only if the category doesn't have any references be able to remove the category. </p>