reuse code of extracting uid from context