This should be a guard statement. Also you should be able to use the idCodec to turn sid into an Id.