/// <summary>
        /// Обновить данные агента недвижимости.
        /// </summary>
        /// <param name="id">Id агента недвижимости.</param>
        /// <param name="value">Обновляемый агент недвижимости.</param>
        /// <returns>Обновленный агент недвижимости.</returns>
        /// <remarks>Пример запроса: PUT api/v1/agents/5
        /// (в теле запроса - <see cref="JsonAgent"/>).</remarks>
        public IAgent Put(int id, [FromBody] JsonAgent value)
        {
            bool canChange = this.AuthorizationMechanism.CanUserChangeAgent(
                this.CurrentUserInfo,
                value);

            if (!canChange)
            {
                this.ThrowUnauthorizedResponseException(
                    "Текущий пользователь не может изменить информацию о данном агенте.");
            }

            IAgent updatedAgent = this.agentsRepository.Update(value);

            this.agentsRepository.SaveChanges();
            return(updatedAgent);
        }
        /// <summary>
        /// Добавить нового агента недвижимости.
        /// </summary>
        /// <param name="value">Новый агент недвижимости.</param>
        /// <returns>Добавленный агент недвижимости.</returns>
        /// <remarks>Пример запроса: POST api/v1/agents
        /// (в теле запроса - <see cref="JsonAgent"/>).</remarks>
        public IAgent Post([FromBody] JsonAgent value)
        {
            bool canAdd = this.AuthorizationMechanism.CanUserAddAgent(
                this.CurrentUserInfo,
                value);

            if (!canAdd)
            {
                this.ThrowUnauthorizedResponseException(
                    "Текущий пользователь не может добавить данного агента.");
            }

            IAgent addedAgent = this.agentsRepository.Add(value);

            this.agentsRepository.SaveChanges();
            return(addedAgent);
        }