templated user db functions