The things happened in the life of Joseph are the shadow fulfillment of the things that are going to happen in the life of Jesus. If you look at the life of Joseph, he was rejected by his own brothers and sold him to ishmaelites, Joseph was jailed without any sin committed and he saved the world from the famine, He got married to the gentile. In same way Jesus was rejected by his own and sold. He was jailed without any sin committed. As world was saved by Joseph in his time without perishing in famine, Jesus saved us from eternal hell. The things happened in life of Joseph are plan of God to save his brothers from dying, not only his brothers but entire world. In same way Jesus saved us all from the sins we have committed by giving Himself as a living sacrifice. He was nailed to cross for our sins, He bore our sins and died, but God rose Jesus on the third day. Since He was rejected by his own brothers or own people, He married to the gentiles, that is salvation is given to gentiles and the entire world was saved from the perishing. God showed us what is going to happen in life of Jesus through life of Joseph.