Cleanup Logging to database

first version of logging actual data to the client database.