implemented insert into db