title: How can I centralize modelstate validation in asp.net mvc using action filters?
body: <p>I write this code in several places and always repeat this logic:</p>
  
  <pre><code>public ActionResult MyMethod(MyModel collection)
  {
      if (!ModelState.IsValid)
      {
          return Json(false);//to read it from javascript, it's always equal
      }
      else
      {
          try
          {
              //logic here
              return Json(true);//or Json(false);
          }
          catch
          {
              return Json(false);//to read it from javascript, it's always equal
          }
      }
  }
  </code></pre>
  
  <p>Is there any way using action filters, not to be repeating the <code>try-catch</code>, ask if the model is valid and <code>return Json(false)</code> as <code>ActionResult</code>?</p>