/// <inheritdoc />
        public async Task Update(long id, PatchOperation[] patches)
        {
            if (await database.Update <ScheduledTask>().Patch(patches).Where(t => t.Id == id).ExecuteAsync() == 0)
            {
                throw new NotFoundException(typeof(ScheduledTask), id);
            }

            if (patches.Any(p => p.Path == "/interval" || p.Path == "/days"))
            {
                ScheduledTask task = await GetById(id);
                await Schedule(id, task.NextExecutionTime(task.LastExecution));
            }
        }