/// <summary>
        /// Turn the coffee machine on.
        /// </summary>
        /// <param name="customMinutesToTurnOff">A custom time in milliseconds to turn of the machine
        /// if automatic turn off mode is switched on.</param>
        private void TurnOnCoffeeMachine(int customMinutesToTurnOff = 0)
        {
            // If delay timer was running, dispose it at this point
            TurnOnCoffeeMachineTimer?.Dispose();

            this.MachineState = CoffeeMachineState.Brewing;

            Ports.Led.Write(true);
            Ports.Relay.Write(false);

            // Setup automatic turn off if requested by the client.
            if (TurnOffMode == TurnOffMode.Automatic)
            {
                // Check if request is overriding previous request and dispose
                // previous turn off timer in that case.
                TurnOffCoffeeTimer?.Dispose();

                TimeSpan dueTime = new TimeSpan(0, customMinutesToTurnOff <= 0 ? TURN_OFF_MIN_DEFAULT : customMinutesToTurnOff, 0);
                TurningMachineOffAt = DateTime.Now.AddTicks(dueTime.Ticks);

                TurnOffCoffeeTimer = new Timer((obj) => { TurnOffCoffeeMachine(); }, null, dueTime, dueTime);
            }
            else
            {
                // Check if request is overriding previous request and dispose
                // previous turn off timer in that case.
                TurnOffCoffeeTimer?.Dispose();
            }
        }
        /// <summary>
        /// Turn coffee machine off.
        /// </summary>
        private void TurnOffCoffeeMachine()
        {
            // If automatic turn off timer was running, dispose it at this point
            TurnOffCoffeeTimer?.Dispose();

            this.MachineState = CoffeeMachineState.Standby;

            Ports.Led.Write(false);
            Ports.Relay.Write(true);
        }