move db adapter to function argument
update tests and pass adapter as argument