private static OperationResponse ItemOperationAddInterestArea(Item item, AddInterestArea operation, InterestArea interestArea)
        {
            if (item.Disposed)
            {
                return operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound");
            }

            lock (interestArea.SyncRoot)
            {
                interestArea.AttachToItem(item);
                interestArea.ViewDistanceEnter = operation.ViewDistanceEnter;
                interestArea.ViewDistanceExit = operation.ViewDistanceExit;
                interestArea.UpdateInterestManagement();
            }

            operation.OnComplete();
            return operation.GetOperationResponse(MethodReturnValue.Ok);
        }
        /// <summary>
        /// Handles operation AddInterestArea: Creates a new InterestArea and optionally attaches it to an existing Item.
        /// </summary>
        public OperationResponse OperationAddInterestArea(PeerBase peer, OperationRequest request, SendParameters sendParameters)
        {
            var operation = new AddInterestArea(peer.Protocol, request);
            if (!operation.IsValid)
            {
                return new OperationResponse(request.OperationCode) { ReturnCode = (int)ReturnCode.InvalidOperationParameter, DebugMessage = operation.GetErrorMessage() };
            }

            operation.OnStart();
            InterestArea interestArea;
            if (this.TryGetInterestArea(operation.InterestAreaId, out interestArea))
            {
                return operation.GetOperationResponse((int)ReturnCode.InterestAreaAlreadyExists, "InterestAreaAlreadyExists");
            }

            interestArea = new ClientInterestArea(this.Peer, operation.InterestAreaId, this.World);
            this.AddInterestArea(interestArea);

            // attach interestArea to item
            if (string.IsNullOrEmpty(operation.ItemId) == false)
            {
                Item item;

                bool actorItem = this.TryGetItem(operation.ItemId, out item);
                if (actorItem)
                {
                    // we are already in the item thread, invoke directly
                    return ItemOperationAddInterestArea(item, operation, interestArea);
                }
                else
                {
                    if (this.World.ItemCache.TryGetItem(operation.ItemId, out item) == false)
                    {
                        return operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound");
                    }
                    else
                    {
                        // second parameter (peer) allows us to send an error event to the client (in case of an error)
                        item.Fiber.Enqueue(() => this.ExecItemOperation(() => ItemOperationAddInterestArea(item, operation, interestArea), sendParameters));
                        // send response later
                        return null;
                    }
                }
            }
            else
            {
                // free floating interestArea
                lock (interestArea.SyncRoot)
                {
                    interestArea.Position = operation.Position;
                    interestArea.ViewDistanceEnter = operation.ViewDistanceEnter;
                    interestArea.ViewDistanceExit = operation.ViewDistanceExit;
                    interestArea.UpdateInterestManagement();
                }

                return operation.GetOperationResponse(MethodReturnValue.Ok);
            }
        }