writeToDb writes timeSpentt to DB
Merging timeSpent with existing code