attach the content ids and store references in the database