public static ByteArrayEntity createExceptionByteArray(String name, byte[] byteArray, ResourceType type) {
    ByteArrayEntity result = null;

    if (byteArray != null) {
      result = new ByteArrayEntity(name, byteArray, type);
      Context.getCommandContext()
        .getByteArrayManager()
        .insertByteArray(result);
    }

    return result;
  }
public static ByteArrayEntity createExceptionByteArray ( String name , byte [ ] byteArray , ResourceType type ) { ByteArrayEntity result = null ; if ( byteArray != null ) { result = new ByteArrayEntity ( name , byteArray , type ) ; Context . getCommandContext ( ) . getByteArrayManager ( ) . insertByteArray ( result ) ; } return result ; }
create ByteArrayEntity with specified name and payload and make sure it's
persisted

used in Jobs and ExternalTasks

@param name - type\source of the exception
@param byteArray - payload of the exception
@param type - resource type of the exception
@return persisted entity