title: Check current Item Id against remote validation MVC
body: <p>I have a scenario where I do not want to allow duplicate entries to database, and for this purpose I use Remote Validation property.
  Inside model</p>
  
  <pre><code>  [Remote("DepartmentNameExists", "Department", "Department Name is already taken.")]
      public string Name { get; set; }
  </code></pre>
  
  <p>Inside Controller</p>
  
  <pre><code>  public JsonResult DepartmentNameExists(string name)
      {
          var user = db.Departments.Where(x =&gt; x.Name == name.Trim());
  
          return !user.Any() ?
            Json(true, JsonRequestBehavior.AllowGet) :
            Json(string.Format("{0} is allready exists.", name),
                JsonRequestBehavior.AllowGet);
  
  
      }
  </code></pre>
  
  <p>It works well for Create view but when go to Edit there is some issues, Like on Edit page submit click it will validate the name again and will prevent page from submitting as already there is same entry in database (which is my current active item itself). How can I solve this problem?
  Note:I can't remove validation from edit page, as there is a chance of user entering any other existing name rather than current one.</p>