added some helper function for database manipulating