hm not sure if defining a helper function as a factory is a good pattern specially if its only used at 1 controller...
maybe check best practices with angular here