Fix database operations

* rename commit to commits to avoid using a keyword
* Convert \DateTime to a database value