Saving sample in workout in HealthKit shows different value

I am creating a workout in Apple Watch and on stop, the workout is saved into the HealthKit. This is being done through the HKLiveWorkoutBuilder. I am only reading the distance, heart rate and steps values from the workout session and calculating the calories from my own formula within the app. But when I save the value of calories by adding the sample in the builder, it shows the different value in the workout section of health app and on clicking its detail it shows the correct value that I saved. What is the issue here? How can I save my own calculated calories value to the workout session recorded in Apple Watch?

Code Block
let quantityType = HKQuantityType.quantityType(forIdentifier: .activeEnergyBurned)!
let unit = HKUnit.largeCalorie()//HKUnit.kilocalorie()
let caloriesBurned = 100.0
let quantity = HKQuantity(unit: unit, doubleValue: caloriesBurned)
let sample = HKQuantitySample(type: quantityType, quantity: quantity, start: self.workoutStartTime, end: Date())
builder.add([sample]) { (success, error) in
   guard success else {
      print("error ======> \(error)")
      return
   }
self.builder.endCollection(withEnd: Date()) { (success, error) in
self.builder.finishWorkout { (workout, error) in
}
}
}
}



Does anybody know the issue here. This is being a major issue the users are facing.
Saving sample in workout in HealthKit shows different value
 
 
Q