refactor multiple extract id methods to common one