model now working with rest api and db