Summary: This logic will be used in a variety of places (update workers, status, etc). Let's move it somewhere common. Reviewed By: xavierd Differential Revision: D20771623 fbshipit-source-id: b4de7c1d20055a10bbc1143d44c55ea1045ec62a