public function getErrorCount($field = null) {
        if ($field === null) {
            return iterator_count($this->getRawErrors());
        } elseif (empty($this->errors[$field])) {
            return 0;
        } else {
            return count($this->errors[$field]);
        }
    }