public async Task <Paycheck> GetPaycheckAsync(Employer employer, string documentId, int cchid) { if (String.IsNullOrWhiteSpace(documentId)) { throw new InvalidOperationException("Invalid documentId."); } if (employer == null || string.IsNullOrWhiteSpace(employer.ConnectionString)) { throw new InvalidOperationException("Invalid employer context."); } _repository.Initialize(employer.ConnectionString); var result = await _repository.GetPaycheckAsync(documentId, cchid); Paycheck paycheck = null; if (result != null) { paycheck = new Paycheck(result); } return(paycheck); }