public BranchOffice VHasUniqueCode(BranchOffice branchOffice, IBranchOfficeService _branchOfficeService) { if (String.IsNullOrEmpty(branchOffice.Code) || branchOffice.Code.Trim() == "") { // branchOffice.Errors.Add("Code", "Tidak boleh kosong"); } else if (_branchOfficeService.IsCodeDuplicated(branchOffice)) { // branchOffice.Errors.Add("Code", "Tidak boleh ada duplikasi"); } return(branchOffice); }