This can stay in the api ( as a private function)