refactor model internal apis.