Make committing a unit of work operate in two phases. Fix date round trips. Resolves #413