Create a container and then AssignClientAuthority

I am trying to understand UNET and how to assign client authority but feel a bit lost. Here is what i am trying to accomplish:

  1. With On_LongTapEnd = create a container i.e. multiple objects (Orange" and “Apple”)
  2. Have “pointer” as parent and assign Orange and Apple as childs
  3. AssignClientAuthority to the Orange and Apple so i can sync the movement of the container (Pointer, Orange and Apple)

I do not understand how to assign client authority to the Orange and Apple in this context so i can move the container.

I do get the following error, see line marked ERROR in the code:

Here is the code i use:

using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
using System.Collections.Generic;

public class Pointer : NetworkBehaviour {

    public Transform myTransform;
    public HashSet<GameObject> linecast_GameObject_HashSet = new HashSet<GameObject> ();
    private List<GameObject> linecast_GameObject_List = new List<GameObject> ();
    private GameObject parentGameObject;
    private GameObject childGameObject;
    private bool firstRun = true;

    // Subscribe to events
    void OnEnable(){
        EasyTouch.On_TouchStart += On_TouchStart;
        EasyTouch.On_Drag += On_Drag;
        EasyTouch.On_DragEnd += On_DragEnd;
        EasyTouch.On_LongTapStart += On_LongTapStart;
        EasyTouch.On_LongTap += On_LongTap;
        EasyTouch.On_LongTapEnd += On_LongTapEnd;
    }
    // Unsubscribe
    void OnDisable(){
        EasyTouch.On_TouchStart -= On_TouchStart;
        EasyTouch.On_Drag -= On_Drag;
        EasyTouch.On_DragEnd -= On_DragEnd;
        EasyTouch.On_LongTapStart -= On_LongTapStart;
        EasyTouch.On_LongTap -= On_LongTap;
        EasyTouch.On_LongTapEnd -= On_LongTapEnd;
    }
    // Unsubscribe
    void OnDestroy(){
        OnDisable ();
        //EasyTouch.On_TouchStart -= On_TouchStart;
    }
    // Touch start event
    public void On_TouchStart(Gesture gesture){
//        Debug.Log( "Touch in " + gesture.position);

        if (!isLocalPlayer)
            return;

        myTransform.position = Camera.main.ScreenToWorldPoint (new Vector3 (gesture.position.x, gesture.position.y, 1f));



    }

    public void On_LongTapStart (Gesture gesture) {
        linecast_GameObject_HashSet.Clear ();
    }

    public void On_LongTap(Gesture gesture) {

        if (!isLocalPlayer)
            return;

        HashSet<GameObject> myList = new HashSet<GameObject> ();
        myList = DoLinecast ();

    }

    public void On_LongTapEnd(Gesture gesture) {
        if (!isLocalPlayer)
            return;

        if (linecast_GameObject_HashSet.Count > 0) {

            foreach (GameObject aGO in linecast_GameObject_HashSet) {
          
                childGameObject = GameObject.FindWithTag (aGO.tag);
                childGameObject.GetComponent<Renderer> ().material.color = Color.green;
                childGameObject.transform.parent = myTransform.transform;

                // Assign Network Authority
                NetworkIdentity myNetID = childGameObject.GetComponent<NetworkIdentity>();
                print ("GO: " + childGameObject.tag + " // myNetID: " + myNetID.netId);
                CmdAssignNetworkAuthority (myNetID.netId);
          
            }

        }


        //CmdDoStuff ();
    }


    [Command]
    public void CmdAssignNetworkAuthority (NetworkInstanceId toId) {
        print ("Incoming ID: " + toId);
        GameObject client = NetworkServer.FindLocalObject (toId);
        var conn = client.GetComponent<NetworkIdentity> ().connectionToClient;
        NetworkIdentity ni = client.GetComponent<NetworkIdentity> ();

        if (ni.clientAuthorityOwner != null) {
            // Remove previous owner
            ni.RemoveClientAuthority (ni.clientAuthorityOwner);
            print ("!= : " + ni.netId + " // name: " + ni.name);
        } else if (ni.clientAuthorityOwner == null) {

            print ("== : " + ni.netId + " // name: " + ni.name);

            //============= ERROR ===============//
            //============= ERROR ===============//
            //============= ERROR ===============//
            ni.AssignClientAuthority (conn); 
            // ==================================//
        }


    }

    public void On_Drag(Gesture gesture) {

        if (!isLocalPlayer)
            return;

        if (isLocalPlayer) {
            gesture.pickedObject.transform.position = Camera.main.ScreenToWorldPoint (new Vector3 (gesture.position.x, gesture.position.y, 1f));
        }
    }

    HashSet<GameObject> DoLinecast () {
        GameObject linecast_GameObject;


        LayerMask theLayer;
        theLayer = (1 << LayerMask.NameToLayer("Fruit")); //set the layer to be clickable
        Vector2 clickedPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        //Get current worldspace position of mouse cursor
        RaycastHit2D[] hits = Physics2D.LinecastAll(clickedPos,clickedPos,theLayer);

        foreach (RaycastHit2D ray in hits) {
            linecast_GameObject = GameObject.Find(ray.collider.name);
            linecast_GameObject_HashSet.Add (linecast_GameObject);
        }

        return linecast_GameObject_HashSet;
    }


    public void On_DragEnd (Gesture gesture) {

        if (linecast_GameObject_HashSet.Count > 0) {

            foreach (GameObject aGO in linecast_GameObject_HashSet) {

                childGameObject = GameObject.FindWithTag (aGO.tag);
                childGameObject.GetComponent<Renderer> ().material.color = Color.white;
                childGameObject.transform.parent = null;

            }

        }
    }





    [Command]
    public void CmdDoPrint(int xx, GameObject aGO) {
        print (xx + ") Ray: " + aGO.name);
  
    }

    [Command]
    public void CmdBIG() {
        print (">>>BIGGER<<<");
    }

    [Command]
    void CmdDoStuff() {
        print ("Tap End");
    }
}

Fixed, i changed this:

[Command]
    public void CmdAssignNetworkAuthority (NetworkInstanceId toId) {
        print ("Incoming ID: " + toId);
        GameObject client = NetworkServer.FindLocalObject (toId);
        var conn = client.GetComponent<NetworkIdentity> ().connectionToClient;
        NetworkIdentity ni = client.GetComponent<NetworkIdentity> ();
        if (ni.clientAuthorityOwner != null) {
            // Remove previous owner
            ni.RemoveClientAuthority (ni.clientAuthorityOwner);
            print ("!= : " + ni.netId + " // name: " + ni.name);
        } else if (ni.clientAuthorityOwner == null) {
            print ("== : " + ni.netId + " // name: " + ni.name);
            //============= ERROR ===============//
            //============= ERROR ===============//
            //============= ERROR ===============//
            ni.AssignClientAuthority (conn);
            // ==================================//
        }
    }

to this:

[Command]
    public void CmdAssignNetworkAuthority (NetworkInstanceId toId) {
        print ("Incoming ID: " + toId);
        GameObject client = NetworkServer.FindLocalObject (toId);
        // >>>>  var conn = client.GetComponent<NetworkIdentity> ().connectionToClient;
        NetworkIdentity ni = client.GetComponent<NetworkIdentity> ();
        if (ni.clientAuthorityOwner != null) {
            // Remove previous owner
            ni.RemoveClientAuthority (ni.clientAuthorityOwner);
            print ("!= : " + ni.netId + " // name: " + ni.name);
        } else if (ni.clientAuthorityOwner == null) {
            print ("== : " + ni.netId + " // name: " + ni.name);
            //============= FIXED ===============//
            //============= FIXED ===============//
           //============= FIXED ===============//
             ni.AssignClientAuthority(connectionToClient);//conn);
            // ==================================//
        }
    }

Thank you so much.