public TEntity ToDomainEntity <TEntity>(IDomainFactory domainFactory) where TEntity : IPersistableEntity { domainFactory.GuardAgainstNull(nameof(domainFactory)); var domainProperties = ConvertToDomainProperties(domainFactory); var result = domainFactory.RehydrateEntity(typeof(TEntity), domainProperties); return((TEntity)result); }