Thread:Extension talk:Collection/sections in contents

Can someone guide me on how add support for handling sections in the contents? What it means is that the TOC of the page would be also part of the sections in the book.