This sample covers the following scenario:
Every course has may chapters, while a chapter can belong to only one course. In the other hand every chapter has many videos while a video can belong to many chapters.
I will write the description below.
This is not how I write code on a daily basis, I brought everything to one place JUST OF THE PURPOS OF demonstrating how this stuff work.
And in this example they do work: