verify the current status to make sure it can be updated to the desired status
function verifyStatusUpdate(exId, desiredStatus) {
        if (!desiredStatus || !_isValidStatus(desiredStatus)) {
            const error = new Error(`Invalid Job status: "${desiredStatus}"`);
            error.statusCode = 422;
            return Promise.reject(error);
        }

        return getStatus(exId)
            .then((status) => {
                // when setting the same status to shouldn't throw an error
                if (desiredStatus === status) {
                    return Promise.resolve();
                }

                // when the current status is running it cannot be set to an init status
                if (_isRunningStatus(status) && _isInitStatus(desiredStatus)) {
                    const error = new Error(`Cannot update running job status of "${status}" to init status of "${desiredStatus}"`);
                    return Promise.reject(error);
                }

                // when the status is a terminal status, it cannot be set to again
                if (_isTerminalStatus(status)) {
                    const error = new Error(`Cannot update terminal job status of "${status}" to "${desiredStatus}"`);
                    return Promise.reject(error);
                }

                // otherwise allow the update
                return Promise.resolve(status);
            });
    }