private static List <InvoiceAttachment> ConvertAttachments(string filePath, string folderPath) { var extension = Path.GetExtension(filePath); var attachmentImages = new List <InvoiceAttachment>(); switch (extension.ToLower()) { case @".msg": attachmentImages = ImageFunctions.ConvertMsgToPng(filePath, folderPath); break; case @".pdf": attachmentImages = ImageFunctions.ConvertPdfToPng(filePath, folderPath); break; case @".tif": case @".tiff": case @".jpg": case @".jpeg": case @".png": case @".bmp": attachmentImages = ImageFunctions.ConvertToPng(filePath, folderPath); break; } return(attachmentImages); }