Moved some source code from Mock-Locationer project for db package.