split EntityWriter off into a separate type