is there a way to refactor this piece of code as it is exactly the same used in schedulartStart command ?