With Non-Continuous Verbs and some non-continuous uses of Mixed Verbs, we use the Past Perfect to show that something started in the past and continued up until another action in the past.
Examples:
•We had had that car for ten years before it broke down.
•By the time Alex finished his studies, he had been in London for over eight years.
•They felt bad about selling the house because they had owned it for more than forty years.
Although the above use of Past Perfect is normally limited to Non-Continuous Verbs and non-continuous uses of Mixed Verbs, the words "live," "work," "teach," and "study" are sometimes used in this way even though they are NOT Non-Continuous Verbs.