Attempts to debug write error in model_db_write.
Re-create function.