hrishi:Adding DB code delete and tweaking code for insert