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

            this._AssetInventoryDetailsRepository.Delete(entity);

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

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

            var entity = model.ToEntity();

            entity = this._AssetInventoryDetailsRepository.Update(entity);

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

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