`write_entry` calls `with_connection` internally, which is messy.  I'd change the private methods to accept a client connection to use.