check if entity is valid