ticket:14 added tests
ticket:14 added db constraints
ticket:14 validation
ticket:14 fixed tests