implement db models

Needs to be review