Move extractClassNameFromExtenalId method to inside try-catch block