Factor out shared code between external solver engines