refactor this checkName to a service