public ActionResult ConfirmMoveIndicators(MoveIndicatorsModel mim, string selectedProfileId, List <int> selectedDomainId, int selectedAreaTypeId, string indicatorTransferDetails) { var groupId = GetSelectedGroupIdUsingProfileKeyDomainAndAreaTypeId(mim.UrlKey, mim.DomainId, mim.AreaTypeId); var modelCount = 0; //There are indicators to delete (move to the archive domain) var indicatorSpecifierStrings = indicatorTransferDetails.Split(',').ToList(); var indicatorSpecifiers = IndicatorSpecifierParser.Parse(indicatorSpecifierStrings); foreach (var indicatorSpecifier in indicatorSpecifiers) { var indicatorId = indicatorSpecifier.IndicatorId; var sexId = indicatorSpecifier.SexId; var ageId = indicatorSpecifier.AgeId; //Don't move if identical indicator already exists in destination. if (!_dataAccess.IndicatorGroupingsExist(indicatorId, Convert.ToInt32(selectedDomainId[0]), mim.AreaTypeId, ageId, sexId)) { var currentIndicator = mim.IndicatorsToTransfer[modelCount]; _dataAccess.MoveIndicatorToDomain(indicatorId, groupId, mim.AreaTypeId, currentIndicator.SexId, currentIndicator.AgeId, selectedDomainId[0], selectedAreaTypeId, sexId, ageId); _dataAccess.LogAuditChange("Indicator " + indicatorId + " moved from [" + mim.DomainName + " (Area: " + mim.AreaTypeId + ", SexId:" + currentIndicator.SexId + ", AgeId:" + currentIndicator.AgeId + " )] Into [" + _reader.GetGroupingMetadataList(selectedDomainId)[0].GroupName + " (Area: " + selectedAreaTypeId + ", SexId:" + sexId + ", AgeId:" + ageId + " )]", indicatorId, null, _userName, DateTime.Now, CommonUtilities.AuditType.Move.ToString()); var indicatorMetadata = _reader.GetIndicatorMetadata(indicatorId); if (indicatorMetadata.OwnerProfileId == mim.Profile.Id) { _dataAccess.UpdateIndicatorOwnership(_reader.GetProfileDetails(selectedProfileId).Id, indicatorId); } } modelCount++; } _writer.ResetSequences(groupId, mim.AreaTypeId); return(Redirect(Request.UrlReferrer.AbsoluteUri)); }