Moved the helper function to a new file for api helper functions