move casting to appframework entity