objectSortByStartPos = function (objectArray) {
    let ObjectByStartPos = objectArray.slice(0);
    ObjectByStartPos.sort(function(a,b) {
        if (a.startPos === b.startPos)
            return a.endPos - b.endPos; 
        return a.startPos - b.startPos;
    });
    return ObjectByStartPos;
}
helper function sort entities list by starting position
@param {object} objectArray array of entity objects
@returns {object} sorted entities array by start position