An extension method for checking if an object is null