This one give robust and tested code for Apex