public static void EncodeEventArg(this RailBitBuffer buffer, Argument arg)
        {
            buffer.Write(NumberOfBitsForArgType, Convert.ToByte(arg.EventType));
            switch (arg.EventType)
            {
            case EventArgType.EntityReference:
                buffer.WriteEntityId(arg.RailId.Value);
                break;

            case EventArgType.MBGUID:
                buffer.WriteMBGUID(arg.MbGUID.Value);
                break;

            case EventArgType.Null:
                // Empty
                break;

            case EventArgType.Int:
                buffer.WriteInt(arg.Int.Value);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }