added foreign function call to fill the object from db.