store previos selections in the database