[easy] split a long function into a helper
[easy] split a long function into a helper

Reviewed By: dsainati1

Differential Revision: D21625023

fbshipit-source-id: 657f7b99339790aa795c7d8e33dd1586a2f661eb

nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow