internal protected void EnableWriteOnReplicas(string viewName, string headStorageAccountName)
        {
            // Assert (headStorageAccountName != null)

            if (!ReplicaChain.Any() ||
                ReplicaChain[0].StorageAccountName != headStorageAccountName)
            {
                return;
            }

            // First, enable Write on all replicas
            foreach (ReplicaInfo replica in GetCurrentReplicaChain())
            {
                replica.Status = ReplicaStatus.ReadWrite;
            }

            // Then, set the head to WriteOnly
            ReplicaChain[0].Status = ReplicaStatus.WriteOnly;

            // one replica chain ? Force to ReadWrite
            if (GetCurrentReplicaChain().Count == 1)
            {
                ReplicaChain[0].Status = ReplicaStatus.ReadWrite;
            }

            // Update view id
            ViewId++;
        }
        internal protected void EnableReadWriteOnReplica(string viewName, string headStorageAccountName)
        {
            if (!ReplicaChain.Any() ||
                ReplicaChain[0].StorageAccountName != headStorageAccountName ||
                ReplicaChain[0].Status != ReplicaStatus.WriteOnly)
            {
                return;
            }

            ReplicaChain[0].Status = ReplicaStatus.ReadWrite;

            // Update view id
            ViewId++;
        }