void SaveLoginLog(LoginLog loginLog) { //recover validator var validator = EntityValidatorFactory.CreateValidator(); if (validator.IsValid(loginLog)) //if favorite is valid { //add the favorite into the repository _loginLogRepository.Add(loginLog); //commit the unit of work _loginLogRepository.UnitOfWork.Commit(); } else //customer is not valid, throw validation errors { throw new ApplicationValidationErrorsException(validator.GetInvalidMessages <LoginLog>(loginLog)); } }