public void Apply(ApplyStateContext context, IWriteOnlyTransaction transaction)
{
var scheduledState = context.NewState as ScheduledState;
if (scheduledState == null)
{
throw new InvalidOperationException(String.Format(
"`{0}` state handler can be registered only for the Scheduled state.",
typeof(Handler).FullName));
}
var timestamp = JobHelper.ToTimestamp(scheduledState.EnqueueAt);
transaction.AddToSet("schedule", context.JobId, timestamp);
}