Write tests and implement code for all db methods