public bool PerformFileUploadOperation(MSI_MediaTracker _mediaTracker, int MediaTypeId, IEnumerable<HttpPostedFileBase> FilesCollection) { Cascade.Data.Repositories.MSIMediaTrackerRepository repository = new MSIMediaTrackerRepository(); string _allMediaDocuments = ""; string _additionalIdentifier = Guid.NewGuid().ToString() + "_" + _mediaTracker.Account + "_" + MediaTypeId.ToString(); //Get all fileNames together so store in the Database foreach (var file in FilesCollection) { if (file != null) { if (_allMediaDocuments.Length > 0) { _allMediaDocuments = _allMediaDocuments + "|" + _additionalIdentifier + "_" + file.FileName; } else { _allMediaDocuments = _additionalIdentifier + "_" + file.FileName; } } } //Now Upload and set the properties foreach (var file in FilesCollection) { if (file != null) { if (file.ContentLength > 0) { //Upload the file fileProcessor.SaveUploadedFileWithIdentifier(file, _additionalIdentifier); } } } if (_allMediaDocuments != "") { //Perform Save Operation _mediaTracker.MediaTypeId = MediaTypeId; _mediaTracker.MediaDocuments = _allMediaDocuments; repository.Add(_mediaTracker); } //response return true; }