Create a factory for a controller