Change name from collection -> factory
middleware for wrapping query and collect params