Get related table API with better error handling.

- getRealTableName() is now GetRealTableName with global visibility

- Replaced NameToGuid() with GetRealTableName()

- Added api/related