consolidate code in task service class

tasx-23