public Candy Get(Candy request)
        {
            if (request == null)
                throw new ArgumentNullException("request");

            var currentProfiler = Profiler.Current;

            if (request.Id != default(uint))
            {
                using (currentProfiler.Step(string.Format("Looking for candy with Id: {0}", request.Id)))
                {
                    var cacheKey = base.Request.PathInfo;

                    using (currentProfiler.Step("Doing cache lookup for candy"))
                    {
                        var cacheItem = Cache.Get<Candy>(cacheKey);

                        if (cacheItem != null)
                            return cacheItem;
                    }

                    using (currentProfiler.Step("Doing db lookup for candy"))
                    {
                        var candy = Db.GetById<Candy>(request.Id);

                        Cache.Add(cacheKey, candy);

                        return candy;
                    }
                }
            }

            throw new ArgumentException("No candy matching Id");
        }
        public object Delete(Candy request)
        {
            Db.DeleteById<Candy>(request.Id);

            return new HttpResult(HttpStatusCode.OK);
        }
        public Candy Post(Candy request)
        {
            if (request.Id != default(uint))
                throw new ArgumentException("Can not insert candy with existing id");

            Db.Insert(request);

            var id = Db.GetLastInsertId();

            request.Id = Convert.ToUInt16(id);

            return request;
        }
        public object Put(Candy request)
        {
            Db.Save(request);

            return request;
        }
 public void Options(Candy request)
 {
 }