public override void Execute() { RavenSession.Store(MenuDefinition); var nextExecution = MenuDefinition.CalculateNextExecutionTime(Now); var task = new ScheduleTask() { Id = MenuDefinition.GetTaskId(), IsActive = nextExecution < DateTime.MaxValue, Command = new ProcessMenuCommand() { MenuDefinitionId = MenuDefinition.Id }, NextExecution = nextExecution }; RavenSession.Store(task); }