FIRST AMENDED AND RESTATED MASTER MORTGAGE LOAN PURCHASE AND WARRANTIES AGREEMENT