/// <summary>
        /// Add timeout id
        /// </summary>
        /// <param name="timeout">The timeout data to add</param>
        /// <param name="context">The context</param>
        /// <returns>The task</returns>
        public Task Add(TimeoutData timeout, ContextBag context)
        {
            var data = new TimeoutEntity()
            {
                Id                   = Guid.NewGuid().ToString(),
                Destination          = timeout.Destination,
                SagaId               = timeout.SagaId,
                State                = timeout.State,
                Time                 = timeout.Time,
                Headers              = timeout.Headers,
                OwningTimeoutManager = timeout.OwningTimeoutManager
            };

            return(this.collection.InsertOneAsync(data));
        }
        /// <summary>
        /// Adds a new timeout.
        /// </summary>
        /// <param name="timeout">Timeout data.</param>
        /// <exception cref="InvalidOperationException">
        /// Throws exception if timeout is not saved.
        /// </exception>
        public void Add(Timeout.Core.TimeoutData timeout)
        {
            var data = new TimeoutData()
            {
                Id                   = Guid.NewGuid().ToString(),
                Destination          = timeout.Destination,
                SagaId               = timeout.SagaId,
                State                = timeout.State,
                Time                 = timeout.Time,
                Headers              = timeout.Headers,
                OwningTimeoutManager = timeout.OwningTimeoutManager
            };

            var collection = this.mongoDatabase.GetCollection <TimeoutData>(TimeoutDataName);
            var result     = collection.Save(data);

            if (result.HasLastErrorMessage)
            {
                throw new InvalidOperationException(string.Format("Unable to save timeout [{0}]", timeout));
            }

            timeout.Id = data.Id;
        }