public void OnConnectionClose(IClientAPI client)
        {
            IScenePresence sp = null;

            client.Scene.TryGetScenePresence(client.AgentId, out sp);
            if (client.IsLoggingOut && sp != null & !sp.IsChildAgent)
            {
                MainConsole.Instance.InfoFormat("[ActivityDetector]: Detected logout of user {0} in region {1}", client.Name,
                                                client.Scene.RegionInfo.RegionName);

                //Inform the grid service about it

                if (m_zombieAgents.Contains(client.AgentId))
                {
                    m_zombieAgents.Remove(client.AgentId);
                    return; //They are a known zombie, just clear them out and go on with life!
                }
                AgentPosition agentpos = new AgentPosition
                {
                    AgentID  = sp.UUID,
                    AtAxis   = sp.CameraAtAxis,
                    Center   = sp.CameraPosition,
                    Far      = sp.DrawDistance,
                    LeftAxis = Vector3.Zero,
                    Position = sp.AbsolutePosition
                };
                if (agentpos.Position.X > sp.Scene.RegionInfo.RegionSizeX)
                {
                    agentpos.Position.X = sp.Scene.RegionInfo.RegionSizeX;
                }
                if (agentpos.Position.Y > sp.Scene.RegionInfo.RegionSizeY)
                {
                    agentpos.Position.Y = sp.Scene.RegionInfo.RegionSizeY;
                }
                if (agentpos.Position.Z > sp.Scene.RegionInfo.RegionSizeZ)
                {
                    agentpos.Position.Z = sp.Scene.RegionInfo.RegionSizeZ;
                }
                if (agentpos.Position.X < 0)
                {
                    agentpos.Position.X = 0;
                }
                if (agentpos.Position.Y < 0)
                {
                    agentpos.Position.Y = 0;
                }
                if (agentpos.Position.Z < 0)
                {
                    agentpos.Position.Z = 0;
                }
                agentpos.RegionHandle     = sp.Scene.RegionInfo.RegionHandle;
                agentpos.Size             = sp.PhysicsActor != null ? sp.PhysicsActor.Size : new Vector3(0, 0, 1.8f);
                agentpos.UpAxis           = Vector3.Zero;
                agentpos.Velocity         = sp.Velocity;
                agentpos.UserGoingOffline = true; //Don't attempt to add us into other regions

                //Send the child agent data update
                ISyncMessagePosterService syncPoster = sp.Scene.RequestModuleInterface <ISyncMessagePosterService>();
                if (syncPoster != null)
                {
                    syncPoster.Post(SyncMessageHelper.SendChildAgentUpdate(agentpos, sp.Scene.RegionInfo.RegionHandle),
                                    sp.Scene.RegionInfo.RegionHandle);
                }
                client.Scene.RequestModuleInterface <ISyncMessagePosterService>().Get(
                    SyncMessageHelper.AgentLoggedOut(client.AgentId, client.Scene.RegionInfo.RegionHandle),
                    client.AgentId, client.Scene.RegionInfo.RegionHandle);
            }
        }