internal static ProgramStateModel InitializeProgramState(ProgramStateModel.ProgramModeType mode, FileInfo sourceFile, FileInfo targetFile)
        {
            if (!sourceFile.Exists)
            {
                throw new ArgumentNullException("Source file does not exists");
            }

            return(ProgramStateModel.Of(sourceFile, targetFile, mode));
        }
        static int Main(ProgramStateModel.ProgramModeType mode, FileInfo sourceFile, FileInfo targetFile)
        {
            //should add mutex to prevent running the same application in second process;
            var _ = Mutex.TryOpenExisting(AppName, out var mtx)
                ? throw new WaitHandleCannotBeOpenedException()
                : new Mutex(false, AppName);

            return(Worker
                   .InitializeProgramState(mode, sourceFile, targetFile)
                   .OpenStreams()
                   .ProcessFilesOperation()
                   .OnError(exception => Console.WriteLine(exception.Message))
                   .OnSuccess(code => Console.WriteLine("Process successfully completed"))
                   .OnComplete(code => (int)code));
        }