Moving database calls up one level to improve reusability