Moved API level usage of internal class GraphDatabaseAPI into internals.

(cherry picked from commit 564e177a3935632b28a819e1b9686bee92c7fe6a)