I have been reading a lot about the Past Perfect tense recently and I think that I am getting more and more confused with the logic behind it the more I read about the tense. Many sources say that we only need to use the past perfect when the sequence of events is not clear without it. Also, they say that we do have to use the past perfect tense every time you mention two things that happened in the past. But many examples that are given about the tense include something like this: "I had switched off the lights before I went to bed" or "after they had had breakfast, they left for the park". Could someone explain to me why the past perfect is necessary in these examples when it is already clear from the sequence of events which action had occurred before the second action?
In your case both constructions would work. I would not use the past perfect in these cases because "after" and "before" already clarify the sequence of events. If you didn't have those, I'd probably go with the "Past Perfect" construction.
When I got to bed, I'd already switched off the light.