public ReferenceDataList List(string key)
        {
            if (key == "{}")
            {
                return(this.GetHandler(
                           key,
                           () =>
                {
                    var entries = this.repository.Queryable <MDM.ReferenceData>().OrderBy(x => x.Key + "|" + x.Value);

                    var list = new ReferenceDataList();
                    list.AddRange(entries.Select(entry => new ReferenceData {
                        ReferenceKey = entry.Key, Value = entry.Value
                    }));

                    return list;
                }));
            }
            else
            {
                return(this.GetHandler(
                           key,
                           () =>
                {
                    var entries = this.repository.Queryable <MDM.ReferenceData>().Where(x => x.Key == key).OrderBy(x => x.Value);

                    var list = new ReferenceDataList();
                    list.AddRange(entries.Select(entry => new ReferenceData {
                        ReferenceKey = entry.Key, Value = entry.Value
                    }));

                    return list;
                }));
            }
        }
        private IHttpActionResult ListAll()
        {
            return(GetHandler(
                       "{}",
                       () =>
            {
                var entries = repository.Queryable <ReferenceData>().OrderBy(x => x.Key + "|" + x.Value);

                var list = new ReferenceDataList();
                list.AddRange(entries.Select(entry => new EnergyTrading.Mdm.Contracts.ReferenceData {
                    ReferenceKey = entry.Key, Value = entry.Value
                }));
                Logger.DebugFormat("ReferenceData list created. Key: {0}", "{}");
                return Ok(list);
            }));
        }
        public IHttpActionResult List(string key = null)
        {
            if (string.IsNullOrEmpty(key) || key == "{}")
            {
                return(ListAll());
            }

            return(GetHandler(
                       key,
                       () =>
            {
                var entries = repository.Queryable <ReferenceData>().Where(x => x.Key == key).OrderBy(x => x.Value);

                var list = new ReferenceDataList();
                list.AddRange(entries.Select(entry => new EnergyTrading.Mdm.Contracts.ReferenceData {
                    ReferenceKey = entry.Key, Value = entry.Value
                }));
                Logger.DebugFormat("ReferenceData list created. Key: {0}", key);
                return Ok(list);
            }));
        }
        public ReferenceDataList List(string key)
        {
            if (key == "{}")
            {
                return this.GetHandler(
                    key,
                    () =>
                    {
                        var entries = this.repository.Queryable<MDM.ReferenceData>().OrderBy(x => x.Key + "|" + x.Value);

                        var list = new ReferenceDataList();
                        list.AddRange(entries.Select(entry => new ReferenceData {ReferenceKey = entry.Key, Value = entry.Value }));

                        return list;
                    });
            }
            else
            {
                return this.GetHandler(
                    key,
                    () =>
                    {
                        var entries = this.repository.Queryable<MDM.ReferenceData>().Where(x => x.Key == key).OrderBy(x => x.Value);

                        var list = new ReferenceDataList();
                        list.AddRange(entries.Select(entry => new ReferenceData {ReferenceKey = entry.Key,  Value = entry.Value }));

                        return list;
                    });
            }
        }
        private IHttpActionResult ListAll()
        {
            return GetHandler(
                "{}",
                () =>
                {
                    var entries = repository.Queryable<ReferenceData>().OrderBy(x => x.Key + "|" + x.Value);

                    var list = new ReferenceDataList();
                    list.AddRange(entries.Select(entry => new EnergyTrading.Mdm.Contracts.ReferenceData { ReferenceKey = entry.Key, Value = entry.Value }));
                    Logger.DebugFormat("ReferenceData list created. Key: {0}", "{}");
                    return Ok(list);
                });
        }
        public IHttpActionResult List(string key = null)
        {
            if (string.IsNullOrEmpty(key) || key == "{}")
            {
                return ListAll();
            }

            return GetHandler(
                key,
                () =>
                {
                    var entries = repository.Queryable<ReferenceData>().Where(x => x.Key == key).OrderBy(x => x.Value);

                    var list = new ReferenceDataList();
                    list.AddRange(entries.Select(entry => new EnergyTrading.Mdm.Contracts.ReferenceData { ReferenceKey = entry.Key, Value = entry.Value }));
                    Logger.DebugFormat("ReferenceData list created. Key: {0}", key);
                    return Ok(list);
                });
        }