I think this special case is unnecessary - I think your logic below will return an empty array if the object is empty?