public Data.Serialize.Consumer GetConsumer(string consumerID)
        {
            Guid guid = new Guid(consumerID);

            Debug.WriteLine(String.Format("GET consumer {0}", consumerID), this.GetType().Name);
            return(DataMarshal.GetConsumer(guid));
        }
        /*
         * public int RequestFloor(System.IO.Stream data)
         * {
         *  int num = 0;
         *  bool success = false;
         *  string content = "";
         *  using (StreamReader sr = new StreamReader(data))
         *  {
         *      content = sr.ReadToEnd();
         *      //Dictionary<string, int> dict =
         *      //    Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, int>>(json);
         *      //dict.TryGetValue("floor", out num);
         *      success = Int32.TryParse(content, out num);
         *  }
         *  if (!success)
         *  {
         *      Debug.WriteLine("Failed to parse floor request: " + content, GetType());
         *      return 0;
         *  }
         *
         *  var accessor = GetConsumerResourceAccessor();
         *  accessor.SetConsumerConfigFloor(num);
         *
         *  return num;
         * }
         *
         * public Stream GetConsumerConfig()
         * {
         *  var accessor = GetConsumerResourceAccessor();
         *  Dictionary<string,Object> d = accessor.GetConsumerConfig();
         *  var json = Newtonsoft.Json.JsonConvert.SerializeObject(d);
         *  return new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json));
         * }
         */

        public Stream GetConsumerLog(string consumerID)
        {
            Guid guid = new Guid(consumerID);

            Debug.WriteLine(String.Format("GET consumer log {0}", consumerID), this.GetType().Name);
            var consumer   = DataMarshal.GetConsumer(guid);
            var instanceID = consumer.instanceID;
            var accessor   = GetConsumerResourceAccessor();
            var builder    = new System.Text.StringBuilder();

            builder.AppendLine(String.Format("instanceID {0} {1} ", consumer.instanceID, consumer.status));
            accessor.GetConsumerLog(instanceID, builder);
            return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(builder.ToString())));
        }
        public Consumer GetConsumerLog(string consumerID)
        {
            Consumer consumer = null;
            Guid     guid     = new Guid(consumerID);

            Debug.WriteLine(String.Format("GET consumer log {0}", consumerID), this.GetType().Name);
            try
            {
                consumer = DataMarshal.GetConsumer(guid);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("No consumer with Id " + consumerID, this.GetType().Name);
                Debug.WriteLine(ex.ToString());
                var detail = new ErrorDetail(
                    ErrorDetail.Codes.DATAFORMAT_ERROR,
                    "No consumer with Id " + consumerID + ", traceback: " + ex.StackTrace.ToString()
                    );
                throw new WebFaultException <ErrorDetail>(detail, System.Net.HttpStatusCode.NotFound);
            }

            return(consumer);
        }