Saving history in the database.
Addedd commands to get and clear history