Move validation handling down to data layer.
Fix minor issue in test setup.