how did joseph end up in egypt