protected object Add(TEntity entity, PrimaryKey pk) { object result = null; try { if (!dbc.IsOpen) { dbc.Open(); } logger.LogInformation($"Add complete for {typeof(TEntity)} entity."); result = dbc.Add <TEntity>(entity, pk); } catch (Exception ex) { logger.LogError(ex.Message); return(null); } return(result); }