method for saving IDs