Changed the API of the MainDBHandler.

Added insert methods to MainDBHandler.
Made changes to the API classes to use insert methods.