public static void FillCollectorFields(StudyUnit newStudyUnit) { foreach (Sampling samplingModel in newStudyUnit.Samplings) { Member member = newStudyUnit.FindMember(samplingModel.MemberId); if (member != null) { samplingModel.LastName = member.LastName; samplingModel.FirstName = member.FirstName; samplingModel.Position = member.Position; Organization membersOrganization = newStudyUnit.FindOrganization(member.OrganizationId); if (membersOrganization != null) { samplingModel.OrganizationName = membersOrganization.OrganizationName; } samplingModel.CollectorTypeCode = Options.COLLECTOR_TYPE_INDIVIDUAL; } else { Organization organization = newStudyUnit.FindOrganization(samplingModel.MemberId); if (organization != null) { samplingModel.OrganizationName = organization.OrganizationName; } samplingModel.CollectorTypeCode = Options.COLLECTOR_TYPE_ORGANIZATION; } } }