Added batch db writes