}
private void writeEventsToDatabaseHelper(Heading root, Stack<String> headingStack, DateExtractor extractor, int rank) {
headingStack.push(root.getTitle());
for(String sentence : root.getSentences()) {
DateAndSentenceTuple c = extractor.extractDate(sentence);
if(c != null) {
writeEvent(c, root.getPage(), headingStack, rank);
}
}
for(Heading h : root.getSubheadings()) {