added tests and logic for creating locations in db