Add isEmpty method of object