private JobHandle internalStartJob(
      final JobFactory factory,
      final String factoryId,
      final String data,
      final Map<String, String> properties) {
    final String id = makeId();

    final JobHandle handle =
        this.storageManager.modifyCall(
            MODEL_KEY,
            JobWriteModel.class,
            jobs -> {
              final JobInstanceEntity ji = new JobInstanceEntity();

              ji.setId(id);
              ji.setFactoryId(factoryId);
              ji.setData(data);
              ji.setState(State.SCHEDULED);
              ji.setLabel(factory.makeLabel(data));
              ji.setProperties(
                  properties != null ? new HashMap<>(properties) : Collections.emptyMap());

              StorageManager.executeAfterPersist(
                  () -> {
                    this.queue.push(new ContextImpl(id, factory, data));
                  });

              jobs.addJob(ji);

              return new JobHandleImpl(ji);
            });

    return handle;
  }
  protected void deleteChannel(final ChannelInstance channel) {
    this.manager.modifyRun(
        KEY_STORAGE,
        ChannelServiceModify.class,
        model -> {
          model.deleteChannel(channel.getChannelId());

          StorageManager.executeAfterPersist(() -> commitDeleteChannel(channel));
        });
  }
 @Override
 public DeployKey updateDeployKey(final String keyId, final String name) {
   return this.manager.modifyCall(
       KEY_STORAGE,
       ChannelServiceModify.class,
       model -> {
         StorageManager.executeAfterPersist(
             () -> {
               updateDeployGroupCache(model);
             });
         return model.updateKey(keyId, name);
       });
 }
 @Override
 public void updateGroup(final String groupId, final String name) {
   try (final Locked l = lock(this.writeLock)) {
     this.manager.modifyRun(
         KEY_STORAGE,
         ChannelServiceModify.class,
         model -> {
           model.updateGroup(groupId, name);
           StorageManager.executeAfterPersist(
               () -> {
                 updateDeployGroupCache(model);
               });
         });
   }
 }