Optimize all EntityId::unserialize

This is related to #219.

The only thing I'm not sure about is that I dropped the is_string check for the type. Is this ok? I think so. A check for allowed types was never done anyway.