finish db insertion