private void BuySnack(string positionString) { int position = int.Parse(positionString); string error = _snackMachine.CanBySnack(position); if (error != string.Empty) { NotifyClient(error); return; } _snackMachine.BuySnack(position); snackMachineRepository.Save(_snackMachine); NotifyClient("You have bought a snack"); }