private IEnumerable<NewlyAddedDocumentGridRowViewModel> CreateNewAddedViewModel(FormCollection formCollection)
        {
            var documentGridRowViewModels = new List<NewlyAddedDocumentGridRowViewModel>();

            var guidRegex =
                new Regex(@"^DocumentGridRow_[\d]+_DocumentLibraryId$");

            foreach (string key in formCollection.Keys)
            {
                if (guidRegex.IsMatch(key))
                {
                    var documentLibraryId = Convert.ToInt64(key.Replace("DocumentGridRow_", "").Replace("_DocumentLibraryId", ""));

                    var documentGridRowViewModel = new NewlyAddedDocumentGridRowViewModel()
                                                       {
                                                           DocumentLibraryId = documentLibraryId,
                                                           Filename =
                                                               formCollection[
                                                                   "DocumentGridRow_" + documentLibraryId.ToString() +
                                                                   "_FileName"],
                                                           Title =
                                                               string.IsNullOrEmpty(
                                                                   formCollection[
                                                                       "DocumentGridRow_" + documentLibraryId.ToString() +
                                                                       "_Title"])
                                                                   ? string.Empty
                                                                   : formCollection[
                                                                       "DocumentGridRow_" + documentLibraryId.ToString() +
                                                                       "_Title"],
                                                           Description =
                                                               formCollection[
                                                                   "DocumentGridRow_" + documentLibraryId.ToString() +
                                                                   "_Description"],
                                                           DocumentTypeId =
                                                               Convert.ToInt64(
                                                                   formCollection[
                                                                       "DocumentGridRow_" + documentLibraryId.ToString() +
                                                                       "_DocumentType"]),
                                                           DocumentOriginTypeId = Convert.ToInt32(formCollection["DocumentGridRow_" + documentLibraryId.ToString() + "_DocumentOriginTypeId"]),
                                                           SiteId =
                                                               string.IsNullOrEmpty(
                                                                   formCollection[
                                                                       "DocumentGridRow_" + documentLibraryId.ToString() +
                                                                       "_Site"])
                                                                   ? default(long)
                                                                   : Convert.ToInt64(
                                                                       formCollection[
                                                                           "DocumentGridRow_" +
                                                                           documentLibraryId.ToString() + "_Site"])
                                                       };
                    documentGridRowViewModels.Add(documentGridRowViewModel);
                }
            }

            return documentGridRowViewModels;
        }
        public PartialViewResult DocumentUploaded(long documentLibraryId, string fileName, int documentOriginTypeId = 0, int documentTypeId = 0, bool canEditDocumentType = false, AttachDocumentReturnView returnView = AttachDocumentReturnView.GeneralRiskAssessmentDocuments)
        {
            var viewModel = new NewlyAddedDocumentGridRowViewModel()
                                                     {
                                                         DocumentLibraryId = documentLibraryId,
                                                         Filename = fileName,
                                                         DocumentOriginTypeId = documentOriginTypeId,
                                                         CanEditDocumentType = canEditDocumentType,
                                                         DocumentTypeId = documentTypeId
                                                     };

            var documentTypes = _lookupService.GetDocumentTypes();

            viewModel.DocumentTypes = new SelectList(documentTypes, "Id", "Name", documentTypeId);


            if (returnView == AttachDocumentReturnView.AddedDocuments)
            {
                viewModel.Sites = GetSites();
                return PartialView("~/Areas/Documents/Views/Document/_AddedDocumentGridRow.cshtml", viewModel);
            }

            return PartialView("~/Areas/Documents/Views/Document/_DocumentGridRow.cshtml", viewModel);
            
        }