Convert entity to a class