This looks duplicated with the code above.

However, if this is temporary code (I hope it is?) until the other libs are updated, it's not worth spending time reducing the duplication.