private void DestroyGraph(Entity e, ref RotateCube_PlayStateRuntime data)
    {
        var set = _animationGraphSystem.Set;

        set.Destroy(data.NodeHandle);
        set.Destroy(data.DeltaTimeNode);
        set.Destroy(data.EntityNode);
        EntityManager.RemoveComponent <RotateCube_PlayStateRuntime>(e);
    }
    private RotateCube_PlayStateRuntime CreateGraph(Entity entity,
                                                    ref Rig rig, ref RotateCube_PlayClipRuntime animation)
    {
        //Retrieve node set from graph system.
        var set = _animationGraphSystem.Set;

        var data = new RotateCube_PlayStateRuntime
        {
            NodeHandle    = set.Create <ClipPlayerNode>(),
            DeltaTimeNode = set.Create <ConvertDeltaTimeToFloatNode>(),
            EntityNode    = set.CreateComponentNode(entity)
        };

        //Connect kernel ports.

        //Connect the entityNode to the deltaNode and pass the DeltaTime Input (struct) to the deltaNode.
        set.Connect(data.EntityNode, data.DeltaTimeNode, ConvertDeltaTimeToFloatNode.KernelPorts.Input);
        //Connect the deltaNode to the ClipPlayerNode and pass the DeltaTime output (float) to the ClipPlayerNode and assign it to the DeltaTime in the ClipPlayerNode.
        set.Connect(data.DeltaTimeNode, ConvertDeltaTimeToFloatNode.KernelPorts.Float, data.NodeHandle,
                    ClipPlayerNode.KernelPorts.DeltaTime);
        //Connect the clipPlayer node to the EntityNode and passes the Output of the ClipPlayerNode
        //We must pass a enum under NodeSet API Connection type which allows feeding information back to an upstream node without forming a cycle
        set.Connect(data.NodeHandle, ClipPlayerNode.KernelPorts.Output, data.EntityNode,
                    NodeSetAPI.ConnectionType.Feedback);

        //EntityNode -> ConvertDeltaTimeToFloatNode -> ClipPlayerNode -> Repeat.

        //Send message to set parameters on the CliPlayerNode

        //Set data for ClipPlayer Kernal Port
        set.SetData(data.NodeHandle, ClipPlayerNode.KernelPorts.Speed, 1.0f);
        //Send Message to ClipPlayer SimulationPort.
        set.SendMessage(data.NodeHandle, ClipPlayerNode.SimulationPorts.Configuration,
                        new ClipConfiguration {
            Mask = ClipConfigurationMask.LoopTime
        });
        set.SendMessage(data.NodeHandle, ClipPlayerNode.SimulationPorts.Rig, rig);
        set.SendMessage(data.NodeHandle, ClipPlayerNode.SimulationPorts.Clip, animation.clip);
        return(data);
    }