Moved response write down to data base requset but this feels wrong.