public Task ClearAsync()
        {
            if ((supportedMethod & Method.Clear) == Method.Clear)
            {
                return(publishingStore.ClearAsync());
            }

            return(Async.CompletedTask);
        }
        /// <summary>
        /// Re-publishes commands from unpublished queue.
        /// Uses <paramref name="formatter"/> to deserialize commands from store.
        /// </summary>
        /// <param name="formatter">The command deserializer.</param>
        /// <returns>The continuation task.</returns>
        public async Task RecoverAsync(IDeserializer formatter)
        {
            Ensure.NotNull(store, "store");
            Ensure.NotNull(formatter, "formatter");

            IEnumerable <CommandModel> models = await store.GetAsync();

            foreach (CommandModel model in models)
            {
                Type     envelopeType = EnvelopeFactory.GetType(Type.GetType(model.CommandKey.Type));
                Envelope envelope     = (Envelope)await formatter.DeserializeAsync(envelopeType, model.Payload);
                await HandleAsync(envelope, false);
            }

            await store.ClearAsync();
        }