Allow array sizes to be checked by validator.
Added support for where conditions on unique validation rule.
merge 4.0 and fix conflicts.