public void SetJobState(string jobId, IState state)
        {
            _transaction.HashSetAsync(
                String.Format(RedisStorage.Prefix + "job:{0}", jobId),
                "State",
                state.Name);
			_transaction.KeyDeleteAsync(String.Format(RedisStorage.Prefix + "job:{0}:state", jobId));

            var storedData = new Dictionary<string, string>(state.SerializeData());
            storedData.Add("State", state.Name);

            if (state.Reason != null)
            {
                storedData.Add("Reason", state.Reason);
            }
			_transaction.HashSetAsync(String.Format(RedisStorage.Prefix + "job:{0}:state", jobId),storedData.ToHashEntries());

            AddJobState(jobId, state);
        }
        public override string CreateExpiredJob(
            Job job,
            IDictionary<string, string> parameters,
            DateTime createdAt,
            TimeSpan expireIn)
        {
            var jobId = Guid.NewGuid().ToString();

            var invocationData = InvocationData.Serialize(job);

            // Do not modify the original parameters.
            var storedParameters = new Dictionary<string, string>(parameters);
            storedParameters.Add("Type", invocationData.Type);
            storedParameters.Add("Method", invocationData.Method);
            storedParameters.Add("ParameterTypes", invocationData.ParameterTypes);
            storedParameters.Add("Arguments", invocationData.Arguments);
            storedParameters.Add("CreatedAt", JobHelper.SerializeDateTime(createdAt));

            var transaction = Redis.CreateTransaction();

            transaction.HashSetAsync(
                    string.Format(RedisStorage.Prefix + "job:{0}", jobId),
                    storedParameters.ToHashEntries());

            transaction.KeyExpireAsync(
                string.Format(RedisStorage.Prefix + "job:{0}", jobId),
                expireIn);

            // TODO: check return value
            transaction.Execute();

            return jobId;
        }