Store values from array to database