Sorry that you have to get a new engine, but if you're about to put it in I'd suggest doing a little maintenance to save you a bunch of headache down the road.
#1 thing is dry compression test it right out of the donor vehicle, it'll give you a health check and indication of what needs to be done. Anything above 150 psi is good, 190+ is excellent. For comparison, mine ranged from 195-210 psi, '11 LR4 5.0 V8 HSE LUX.
While the motor is out, replace the timing chain guides, tensioner, chains and such. New spark plugs. New valve cover gaskets. Clean or new injectors. Decarbonize intake valves. Replace the cooling components, front/rear crossover pipes, water pump, oil cooler pipe, thermostat, bleeder ***** (with a bmw brass *****).
Debatable, I also recommend flushing out your oem coolant to dexcool. Dexcool is available everywhere, easy to find in remote areas. Most parts in our trucks are FoMoCo (Ford Motor Company) and utilizes Dexcool in their cooling systems. After the engine is installed, just put distilled water in, start it up, blast heater Front and Rear (if you have it) to flush out all the old coolant, repeat the process until absolutely clear, and then introduce 1.5 gallons of concentrated dexcool. It'll eventually mix with the distilled water to get a 50/50 mix. The system with rear heater is about 3 gallons. I've been running it for the past 3-4 years without issues.
I've done all this 2 years ago and I'm really hoping that it'll last me at least another 100k.