persists image groups to database