public int TryRemoveFromBuffer() //tested
        {
            Neurotransmitter removed = buffer.Take();
            int charge = removed.Charge;

            int oldMembranePotential = membranePotential;

            //affect local membrane potential
            int currentMembranePotential = Interlocked.Add(ref membranePotential, charge);


            //decide whether change was significant enough to add to SecondaryMessenger
            if (Math.Abs(currentMembranePotential - oldMembranePotential) > significantVoltageChange)
            {
                messenger.AddEvent(DateTime.Now);

                //check whether dendrite growth state threshold reached
                if (state == 0 && messenger.IsGrowthStateTriggered(DateTime.Now))
                {
                    SetGrowthState();
                }
            }

            return(charge);
        }
        //ActionPotentialEvent code
        public void ReceiveActionPotentialEvent(object sender, EventArgs_ActionPotential e) //tested
        {
            Console.WriteLine("Neuron receives action potential event.");

            //add to secondary messenger for checking
            messenger.AddEvent(e.When);

            //check whether threshold is met for cell growth event
            CheckCellGrowthEventThreshold();
        }