This seems like it should be a utility function rather than duplicated logic with the class above.