This example shows different approaches to reduce code repetition.
Please compare the starting code with these different approaches:
Object orientated programming
Generic data source
Many thanks go to https://github.com/helje5
Feel free to push your appraoch.