change tidy up logic for database in tests
clean up tests
fixed tests where model state iis made invalid
add tear downs to tests