protected IConfigurable GetDataObject <TObject>(IIdentityParameter id, IConfigDataProvider session, ObjectId rootID, OptionalIdentityData optionalData, LocalizedString?notFoundError, LocalizedString?multipleFoundError, ExchangeErrorCategory errorCategory) where TObject : IConfigurable, new() { IConfigurable result = null; LocalizedString? localizedString; IEnumerable <TObject> dataObjects = this.GetDataObjects <TObject>(id, session, rootID, optionalData, out localizedString); Exception ex = null; using (IEnumerator <TObject> enumerator = dataObjects.GetEnumerator()) { if (enumerator.MoveNext()) { result = enumerator.Current; if (enumerator.MoveNext()) { ex = new ManagementObjectAmbiguousException(multipleFoundError ?? Strings.ErrorManagementObjectAmbiguous(id.ToString())); } } else if (notFoundError != null) { LocalizedString message; if (localizedString != null) { LocalizedString?localizedString2 = notFoundError; string notFound = (localizedString2 != null) ? localizedString2.GetValueOrDefault() : null; LocalizedString?localizedString3 = localizedString; message = Strings.ErrorNotFoundWithReason(notFound, (localizedString3 != null) ? localizedString3.GetValueOrDefault() : null); } else { message = notFoundError.Value; } ex = new ManagementObjectNotFoundException(message); } else { ex = new ManagementObjectNotFoundException(localizedString ?? this.GetErrorMessageObjectNotFound(id.ToString(), typeof(TObject).ToString(), (this.DataSession != null) ? this.DataSession.Source : null)); } } if (ex != null) { if (errorCategory != (ExchangeErrorCategory)0) { RecipientTaskHelper.SetExceptionErrorCategory(ex, errorCategory); } throw ex; } return(result); }