How can I combine counting rows in an IDictionary with merging rows?
<p>I have the following class that checks for errors:</p>

<pre><code>   public bool ValidateAccountDeletion(Account account)
    {
        var _errors = new Dictionary&lt;string, string&gt;();
        var accounts = _accountRepository.GetPk(account.PartitionKey);
        if (_productRepository.GetPk("0000" + account.RowKey).Count() != 0)
            _errors.Add("", "Account contains products");
        return _errors;
    }
</code></pre>

<p>and the following extension class to merge my IDictionary and the ModelStateDictionary</p>

<pre><code>public static class ModelExtensions {
    public static bool HasValue(this string value) {
        return !string.IsNullOrEmpty(value) &amp;&amp; value.Trim().Length &gt; 0;
    }

    public static void Merge(this ModelStateDictionary modelState, IDictionary&lt;string, string&gt; dictionary) {
        Guard.AgainstNullParameter(modelState, "modelState");
        Guard.AgainstNullParameter(dictionary, "dictionary");

        foreach(var item in dictionary) {
            modelState.AddModelError(item.Key, item.Value);
        }
    }
</code></pre>

<p>When I call the validate and the then try to merge it doesn't look clean:</p>

<pre><code>        var errors = _accountService.ValidateAccount(vm.Account);
        if (errors.Count &gt; 0) 
            this.ModelState.Merge(errors)
</code></pre>

<p>Is there some way that I could maybe have a different constructor to merge and then just feed in the output
of:</p>

<pre><code> _accountService.ValidateAccount(vm.Account);
</code></pre>

<p>I am trying to think of how I could do this but can't think of a simple way</p>
