insert into db once per array