Insert to Database

Fixing the issue with data not being inserted to the database properly.