AccountResponceMessage Receive(AccountInformationMessage message)
        {
            IImplementation implementation = _implementation;

            if (implementation != null && OperationalState == OperationalStateEnum.Operational)
            {
                AccountInfo?updatedInfo = implementation.GetAccountInfoUpdate(message.AccountInfo);
                if (updatedInfo.HasValue)
                {
                    if (message.RequestResponce)
                    {
                        return(new AccountResponceMessage(updatedInfo.Value, true));
                    }
                    else
                    {
                        SendResponding(message.TransportInfo, new AccountResponceMessage(updatedInfo.Value, true));
                    }
                }
            }

            if (message.RequestResponce)
            {
                return(new AccountResponceMessage(message.AccountInfo, false));
            }
            else
            {
                return(null);
            }
        }
        AccountResponseMessage Receive(AccountInformationMessage message)
        {
            IImplementation implementation = _implementation;

            if (implementation == null || OperationalState != OperationalStateEnum.Operational)
            {
                if (message.RequestResponse)
                {
                    return(new AccountResponseMessage(message.AccountInfo, false));
                }
                else
                {
                    return(null);
                }
            }

            AccountInfo?updatedInfo = implementation.GetAccountInfoUpdate(message.AccountInfo);

            if (updatedInfo.HasValue == false)
            {// Implementation has no knowledge of this, or does not wish to handle this, so provide info if we have any.
                lock (this)
                {
                    if (_accounts.ContainsKey(message.AccountInfo.Id))
                    {
                        updatedInfo = _accounts[message.AccountInfo.Id];
                    }
                }
            }

            if (updatedInfo.HasValue == false)
            {
                if (message.RequestResponse)
                {
                    return(new AccountResponseMessage(message.AccountInfo, false));
                }
                else
                {
                    return(null);
                }
            }

            if (message.RequestResponse)
            {
                return(new AccountResponseMessage(updatedInfo.Value, true));
            }
            else
            {
                SendResponding(message.TransportInfo, new AccountInformationUpdateMessage(updatedInfo.Value, true));
                return(null);
            }
        }
        AccountResponseMessage Receive(AccountInformationMessage message)
        {
            IImplementation implementation = _implementation;
            if (implementation == null || OperationalState != OperationalStateEnum.Operational)
            {
                if (message.RequestResponse)
                {
                    return new AccountResponseMessage(message.AccountInfo, false);
                }
                else
                {
                    return null;
                }
            }

            AccountInfo? updatedInfo = implementation.GetAccountInfoUpdate(message.AccountInfo);
            if (updatedInfo.HasValue == false)
            {// Implementation has no knowledge of this, or does not wish to handle this, so provide info if we have any.
                lock (this)
                {
                    if (_accounts.ContainsKey(message.AccountInfo.Id))
                    {
                        updatedInfo = _accounts[message.AccountInfo.Id];
                    }
                }
            }

            if (updatedInfo.HasValue == false)
            {
                if (message.RequestResponse)
                {
                    return new AccountResponseMessage(message.AccountInfo, false);
                }
                else
                {
                    return null;
                }
            }

            if (message.RequestResponse)
            {
                return new AccountResponseMessage(updatedInfo.Value, true);
            }
            else
            {
                SendResponding(message.TransportInfo, new AccountInformationUpdateMessage(updatedInfo.Value, true));
                return null;
            }
        }
        AccountResponceMessage Receive(AccountInformationMessage message)
        {
            IImplementation implementation = _implementation;
            if (implementation != null && OperationalState == OperationalStateEnum.Operational)
            {
                AccountInfo? updatedInfo = implementation.GetAccountInfoUpdate(message.AccountInfo);
                if (updatedInfo.HasValue)
                {
                    if (message.RequestResponce)
                    {
                        return new AccountResponceMessage(updatedInfo.Value, true);
                    }
                    else
                    {
                        SendResponding(message.TransportInfo, new AccountResponceMessage(updatedInfo.Value, true));
                    }
                }
            }

            if (message.RequestResponce)
            {
                return new AccountResponceMessage(message.AccountInfo, false);
            }
            else
            {
                return null;
            }
        }