private static ITransferService GetTransferService(
     TransferProtocol protocol,
     ITransmissionDetails transmissionDetails)
 {
     return(new ConcreteTransferServiceFactory(
                protocol, transmissionDetails.ConnectionDetails)
            .GetService());
 }/*End of GetTransferService method*/
        }/*End of RemoveFile method*/

        public IProcessResult FileExists(TransferProtocol protocol,
                                         ITransmissionDetails transmissionDetails)
        {
            switch (protocol)
            {
            case TransferProtocol.Sftp:
            case TransferProtocol.Ftp:
                return(FileExistsFileTransfer(protocol, transmissionDetails));

            default:
                throw new System.ArgumentException($"Invalid Transfer Protocol: {protocol}");
            }
        }/*End of FileExists method*/
        }/*End of RemoveFileTransfer method*/

        private IProcessResult FileExistsFileTransfer(
            TransferProtocol protocol,
            ITransmissionDetails transmissionDetails)
        {
            TransferProtocolProcessState StateCheck(bool p) => p
                ? TransferProtocolProcessState.Success
                : TransferProtocolProcessState.CheckExistsFailed;

            var fileProtocolWorker
                = GetTransferService(protocol, transmissionDetails);

            return(fileProtocolWorker.CheckIfFileExists(
                       transmissionDetails.FileIoDetails.DirectoryName,
                       transmissionDetails.FileIoDetails.FileName,
                       StateCheck));
        }/*End of FileExistsFileTransfer method*/
        }/*End of ListFiles method*/

        private IProcessResult DownloadFileViaFileTransfer(
            TransferProtocol protocol,
            ITransmissionDetails transmissionDetails)
        {
            TransferProtocolProcessState StateCheck(bool p) => p
                ? TransferProtocolProcessState.Success
                : TransferProtocolProcessState.DownloadFailed;

            var fileProtocolWorker
                = GetTransferService(protocol, transmissionDetails);

            return(fileProtocolWorker.DownloadFile(
                       transmissionDetails.TransferDetails.SourceDirectory,
                       transmissionDetails.TransferDetails.SourceFileName,
                       transmissionDetails.TransferDetails.DestinationDirectory,
                       transmissionDetails.TransferDetails.DestinationFileName,
                       StateCheck,
                       transmissionDetails.TransferDetails.OverrideExisting));
        }/*End of DownloadFileViaFileTransfer method*/
        }/*End of FileExistsFileTransfer method*/

        private IProcessResult <IEnumerable <string> > ListFilesFileTransfer(
            TransferProtocol protocol,
            ITransmissionDetails transmissionDetails)
        {
            TransferProtocolProcessState StateCheck(bool p) => p
                ? TransferProtocolProcessState.Success
                : TransferProtocolProcessState.ListDirectoryFailed;

            var fileProtocolWorker
                = GetTransferService(protocol, transmissionDetails);
            var result = fileProtocolWorker.ListDirectoryContent(
                transmissionDetails.FileIoDetails.DirectoryName,
                StateCheck, file => true,
                transmissionDetails.ConnectionDetails.DisconnectOnComplete);

            return(new ProcessResult <IEnumerable <string> >
            {
                ProcessCompletionState = result.ProcessCompletionState,
                ProcessResultException = result.ProcessResultException,
                ProcessResultMessage = result.ProcessResultMessage,
                ProcessResultValue = result.ProcessResultValue
            });
        } /*End of ListFilesFileTransfer method*/