move export implementation to QueryController
use state in exporter