MVC's Model isn't valid even with 0 errors
<p>Here, I'm simply checking if some codes are valid for the type of report that they are used in, and also if there are same occurances of codes. I paused the code (with F9) on the first line of this function, and checked the <code>ModelState.IsValid</code>, and it said that it is <code>false</code>.</p>

<pre><code>[HttpPost]
    public ActionResult Edit(ReportEditModel report)
    {
        // some preparation code here
        foreach (PairViewModel pair in report.Pairs)
        {
            if (pair.CodeId == 0 &amp;&amp; pair.Amount == 0) continue;

            if (!validCodes.Contains(pair.CodeId))
                ModelState.AddModelError("WrongCode", "Kod " + pair.CodeId + " ne postoji");

            foreach(PairViewModel pair2 in report.Pairs)
                if(pair.CodeId == pair2.CodeId &amp;&amp; pair != pair2)
                    ModelState.AddModelError("DoubleCode", "Kod " + pair.CodeId + " se ponavlja više od jednog puta");
        }

        if (!ModelState.IsValid)
            return View(report);

        var newPairs = from r in report.Pairs
                       select new Pair()
        // blah, blah, blah...
</code></pre>

<p>I'm having trouble understanding why my model is invalid all the time. I have no Annotations in any of my models, so the only way to say: "Hey model, there is an error!" is by using <code>ModelState.AddModelError</code>, but the line <code>if (!ModelState.IsValid) return View(report);</code> always fires. I the <code>ModelState.IsValid</code> is always false, but I can't see any errors in <code>ModelState</code>.</p>

<p>There is only 1 property of model in question, a <code>public IList&lt;int&gt; ValidCodes { get; set; }</code>, that is empty when it comes back from view to this action.</p>

<p>Please, point me the mistake in my code, if any. How can I check for errors other than pausing at some X line of code and howering over <code>MouseState</code> to check it's keys and errors?</p>