move utility method to service (fix #463)