/// <summary> /// Create a new instance of a Research File. /// </summary> /// <returns></returns> public static Entity.PimsResearchFile CreateResearchFile(this PimsContext context, long?researchFileId = null, string rfileNumber = null) { var statusType = context.PimsResearchFileStatusTypes.FirstOrDefault() ?? throw new InvalidOperationException("Unable to find research status type."); var researchFile = EntityHelper.CreateResearchFile(statusType: statusType, researchFileId: researchFileId, rfileNumber: rfileNumber); context.PimsResearchFiles.Add(researchFile); return(researchFile); }