public DataReturnUpload CreateDataReturnUpload(Scheme scheme, DataReturnVersion dataReturnVersion = null) { int dataReturnUploadId = GetNextId(); DataReturnUpload dataReturnUpload = new DataReturnUpload { Id = IntegerToGuid(dataReturnUploadId), SchemeId = scheme.Id, Scheme = scheme, Data = string.Format("<SchemeReturn{0} />", dataReturnUploadId), Date = DateTime.UtcNow, ProcessTime = TimeSpan.Zero }; if (dataReturnVersion != null) { dataReturnUpload.DataReturnVersionId = dataReturnVersion.Id; dataReturnUpload.DataReturnVersion = dataReturnVersion; if (dataReturnVersion.DataReturn != null) { dataReturnUpload.ComplianceYear = dataReturnVersion.DataReturn.ComplianceYear; dataReturnUpload.Quarter = dataReturnVersion.DataReturn.Quarter; } } model.DataReturnUploads.Add(dataReturnUpload); return dataReturnUpload; }