public function track($trackingId, $resource, $eventsMask = FilesystemEvent::ALL)
    {
        if ('all' === $trackingId) {
            throw new InvalidArgumentException(
                '"all" is a reserved keyword and can not be used as tracking id'
            );
        }

        if (!$resource instanceof ResourceInterface) {
            if (is_file($resource)) {
                $resource = new FileResource($resource);
            } elseif (is_dir($resource)) {
                $resource = new DirectoryResource($resource);
            } else {
                throw new InvalidArgumentException(sprintf(
                    'Second argument to track() should be either file or directory resource, '.
                    'but got "%s"',
                    $resource
                ));
            }
        }

        $trackedResource = new TrackedResource($trackingId, $resource);
        $this->getTracker()->track($trackedResource, $eventsMask);
    }