Removed relational model and replaced with metadata model where needed.

Updated related code and tests.
Move it so that we can remove the Model namespace and fix #803.