Added functionality to DatabaseBasedDataStoreCreator.

Made sure that the database based datastore works now. Added some refactorings too.

This will be the last pull request I will issue. I will wait for you to integrate your stuff first. I will do a fresh clone of the repo and then retire this fork.