/// <summary>
        /// Delete an entity.
        /// </summary>
        /// <param name="model"></param>
        public void Delete(AccountChartLevelSettingViewModel model)
        {
            var entity = model.ToEntity();

            this._AccountChartLevelSettingsRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
        /// <summary>
        /// Throw an exception if name is exist.
        /// </summary>
        /// <param name="model">AccountChartLevelSetting view model</param>
        public void ThrowExceptionIfExist(AccountChartLevelSettingViewModel model)
        {
            ConditionFilter <AccountChartLevelSetting, long> condition = new ConditionFilter <AccountChartLevelSetting, long>
            {
                Query = (entity =>
                         entity.Level == model.Level &&
                         entity.Id != model.Id)
            };
            var existEntity = this._AccountChartLevelSettingsRepository.Get(condition).FirstOrDefault();

            if (existEntity != null)
            {
                throw new ItemAlreadyExistException();
            }
        }
        /// <summary>
        /// Update an entity.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public AccountChartLevelSettingViewModel Update(AccountChartLevelSettingViewModel model)
        {
            this.ThrowExceptionIfExist(model);

            var entity = model.ToEntity();

            entity = this._AccountChartLevelSettingsRepository.Update(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion

            model = entity.ToModel();
            return(model);
        }