Move DB helper functions from HMLoader to Data.