public ParcelManagerServiceResult <IEnumerable <Parcel> > Create(string fileName) { try { //getting the physical path of xml file ParcelManagerServiceResult <string> fullPathResult = file.GetFullPath(fileName); if (!fullPathResult.Success) { return(new ParcelManagerServiceResult <IEnumerable <Parcel> >(error: fullPathResult.Error)); } //reading the content of xml as string ParcelManagerServiceResult <string> fileContentReaderResult = file.ReadFileAsText(fullPathResult.Result); if (!fileContentReaderResult.Success) { return(new ParcelManagerServiceResult <IEnumerable <Parcel> >(error: fullPathResult.Error)); } // Deserialize Content to Container Object Container container = serialization.DeserializeXml <Container>(fileContentReaderResult.Result); return(new ParcelManagerServiceResult <IEnumerable <Parcel> >(result: container.Parcels)); } catch (System.Exception exception) { return(new ParcelManagerServiceResult <IEnumerable <Parcel> >(error: ErrorType.ErrorIsUnkownPleaseContactAdmin, message: exception.Message)); } }