private void StateChanged()
{
LastUpdatedTime = DateTime.Now;
// if the state is terminal and we've not yet recorded an end time then record it
if(EndTime.HasValue == false && (State == OperationState.Completed || State == OperationState.CompletedWithWarnings || State == OperationState.Failed))
{
EndTime = DateTime.Now;
}
}