/// <summary>
        /// Perform the action
        /// </summary>
        /// <param name="action">the given action</param>
        /// <returns>the returned action (or null)</returns>
        public CompoundTerm DoAction(CompoundTerm action)
        {
            switch (action.FunctionSymbol.ToString())
            {
            case "Insert":
            {
                Coin coin = GetCoin(action.Arguments[0]);
                EmptyCoffeeMachineImpl.InsertACoin(coin);
                return(null);
            }

            case "Cancel":
            {
                Term coin = CompoundValue.GetTerm(EmptyCoffeeMachineImpl.Cancel());
                return(new CompoundTerm(Symbol.Parse("Return"), coin));
            }

            default:
                throw new InvalidOperationException("Unrecognized action: " + action.ToString());
            }
        }