Adds ability to dynamically find auto-increment id.

Previously, when persisting entities, we always start the
auto-incrementing id at 0, regardless of the entities already in the
table. This commit changes allows us to take the max value for the id column
of a table when finding the autogenerated id to persist.
Whoops, fixed.