/// <summary>
        /// Adds the specified endpoint.
        /// </summary>
        /// <param name="newAgent">The new agent.</param>
        public AgentInformation Add(AgentInformation newAgent)
        {
            lock (SyncObject)
            {
                var agent = GetBy(newAgent.Name);

                if (agent == null)
                {
                    agent = Get(a => a.Address.Equals(newAgent.Address));

                    if (agent != null)
                    {
                        // The name of an existent agent has changed
                        agent.Name = newAgent.Name;
                    }
                    else
                    {
                        // Agent was NOT found either by name or by address
                        agents.Add(agent = newAgent);
                        agent.StateChanged += OnAgentStateChanged;

                    }
                }

                agent.LastStatusUpdate = newAgent.LastStatusUpdate;
                agent.Address = newAgent.Address;
                agent.Version = newAgent.Version;

                return agent;
            }
        }
 /// <summary>
 /// Moves to busy.
 /// </summary>
 /// <param name="agent">The agent.</param>
 public void MarkBusy(AgentInformation agent)
 {
     agent.State = AgentState.Busy;
 }
 /// <summary>
 /// Marks the free.
 /// </summary>
 /// <param name="agent">The agent.</param>
 public void MarkAsReady(AgentInformation agent)
 {
     agent.State = AgentState.Ready;
 }