saving mapping to the database