Except for changing the encode() function, it seems nothing more has to be changed. I've notice the entityId+"-"+entityType is used for creating a resourceId, and it is always used in that way (entityId+"-"+entityType), thus it should be OK. Nevertheless, when refactoring the code searching for common functionality I'll check everything again.