/// <summary>
        /// Deletes the given model.
        /// </summary>
        /// <typeparam name="T">Type of Model</typeparam>
        /// <param name="id">ID of the Model</param>
        /// <param name="validatePermissions">Validates that the current user and current application have access to do this. Hooks and rules will typically have this as false.</param>
        public void Delete <T>(int id, bool validatePermissions = true) where T : Model
        {
            var logName = string.Format("for {0}.Id {1}", typeof(T).Name, id);

            this.Logger.AppendLine(string.Format("Delete started {0}", logName));

            if (validatePermissions && _securityContext == null)
            {
                throw new InvalidAccessTokenException();
            }

            var sw = Stopwatch.StartNew();

            var model = this.Set <T>().FirstOrDefault(x => x.Id == id);

            if (model == null)
            {
                throw new ModelNotFoundException();
            }

            var deleteHelper = new DeleteHelper <T>(model, this, validatePermissions);

            deleteHelper.Execute();

            sw.Stop();
            this.Logger.AppendLine(string.Format("Delete done {0}: {1} ms", logName, sw.ElapsedMilliseconds));
        }