Fixing inserting metrics data into db.
Refactoring construction of json-based responses.