BS-11109 : Merge Master in the branch of Rest API

Refactor code to remove duplicated code on the scheduler