public bool Update(Pulse entity) { using (logger.BeginScope(nameof(this.Update))) { if (entity == null) { logger.LogWarning("ArgumentNullException while updating pulse in DB"); return false; } using (var context = new PsqlContext()) { try { DbPulse dbPulse = entity.ToDbEntity(); context.Pulse.Update(dbPulse); context.SaveChanges(); logger.LogDebug("Pulse updated successfully"); return true; } catch (Exception e) { logger.LogWarning(e.ToString() + " while updating pulse in DB"); return false; } } } }