Added validation constraints.

Added db and app level constraints.