Changed handling of the entityId - conversion according to review.