This method could also go into a util file, I think we have more than one place where this is needed?