database first implementation