public static RenewalToolWriteOffAndReinCost Get(string projectId, Guid toolId, NodeInfo nodeInfo = null) { Log4netHelper.WriteInfo( JsonConvert.SerializeObject(new { desc = "write off and rein cost", projectId, toolId, nodeInfo })); var entity = FirstOrDefault(w => w.ToolId == toolId); if (entity == null) { entity = new RenewalToolWriteOffAndReinCost(); entity.Id = Guid.NewGuid(); entity.ToolId = toolId; entity.Add(); } return(entity); }