updated the database validation to be cleaner across the handlers