private IDocument CreateOrLoadExistingRemoteDocument(IFileInfo localFile, IObjectId parentId) {
IDocument result;
IFileTransmissionObject transmissionObject = this.TransmissionStorage.GetObjectByLocalPath(localFile.FullName);
if (transmissionObject != null) {
try {
result = this.Session.GetObject(transmissionObject.RemoteObjectId) as IDocument;
} catch (CmisObjectNotFoundException) {
this.TransmissionStorage.RemoveObjectByRemoteObjectId(transmissionObject.RemoteObjectId);
result = this.CreateCheckedOutDocument(localFile, parentId);
}
} else {
result = this.CreateCheckedOutDocument(localFile, parentId);
}
return result;
}