I have written about the doctrine of adoption before and how in his book, Knowing God, Jim Packer considers adoption the highest privilege of the gospel—higher even than justification—because of the richness of the relationship with God with which it is associated.
In adoption, God takes us into his family and fellowship—he establishes us as his children and heirs. Closeness, affection and generosity are at the heart of the relationship. To be right with God the Judge [justification] is a great thing, but to be loved and cared for by God the Father [adoption] is a greater. 
At St Mary-le-Tower in Ipswich (where I count it a great privilege to sing evensong fairly regularly) members are reading Paula Gooder’s book, Journey to the Manger. I am a little late getting started and so only today read the first few chapters. I certainly wasn’t expecting to find the doctrine of adoption in the Christmas story, and especially not in the genealogies from the beginning of the gospels of Matthew and Luke.
The point has been made plenty of times that the genealogies in the gospels hold such encouragement for us, that fallen men and fallen women can still be part of God’s plan. Paula Gooder puts it like this:
Whoever we are, however ramshackle and dubious we might be, the God who needed Judah and Tamar, Rahab and Salmon, Boaz and Ruth, David and Bathsheba and Mary and Joseph needs us to be part of his plan 
I would quibble at the use of the word “need” (see for example Acts 17:25) and prefer to use the much richer and more biblical thought that God actively chooses us to be part of his plan, and of course that’s what the doctrine of adoption talks about too as Ephesians 1 makes clear.
3 Blessed be the God and Father of our Lord Jesus Christ, who has blessed us in Christ with every spiritual blessing in the heavenly places, 4 even as he chose us in him before the foundation of the world, that we should be holy and blameless before him. In love 5 he predestined us for adoption to himself as sons through Jesus Christ, according to the purpose of his will (Ephesians 1:3-5, ESV)
Returning to the genealogies, one issue some people may have with the genealogies is that Jesus’ ancestry is traced through Joseph, who, as the gospels make very clear, was NOT Jesus’ biological father. Paula Gooder explains one way of looking at this, which was a delightful surprise to me, as she talks about the “great cultural clashes that from time to time to time disrupt our ability to understand what is going on in a biblical passage.” 
The key here is adoption in the ancient world. Adoption was widespread within both Roman and Jewish society. The difference between Roman and Jewish adoption was that…in Jewish society adoption of babies was more common… For both societies adoption was absolute, and the adoptee was to be treated as though they were the biological child of the new parents. Legally and formally, then, they were treated as part of that new family. 
At Christmas Jesus is born for us so we ourselves can be born anew:
Come to be born, to bear us to our new birth 
In the same way, perhaps, Jesus is adopted into an earthly family, irrevocably, securely so that we too might receive adoption as sons and daughters.
But when the fullness of time had come, God sent forth his Son, born of woman, born under the law, to redeem those who were under the law, so that we might receive adoption as sons. And because you are sons, God has sent the Spirit of his Son into our hearts, crying, “Abba! Father!” So you are no longer a slave, but a son, and if a son, then an heir through God. (Galatians 4:4–7, ESV)
 Packer, J. I. (1975). Knowing God. London: Hodder and Stoughton.
 Gooder, P. (2015). Journey to the manger: Exploring the birth of Jesus. Norwich: Canterbury Press, 10-11
 Ibid. p.9
 Guite, M. (2015). Waiting on the word: A poem a day for Advent, Christmas and Epiphany. Norwich: Canterbury Press, 87