public async Task DeleteFile(string name, FileServerClient client)
        {
            var requestPath = client.GetRequestPath(name);
            var ftpRequest = (FtpWebRequest)WebRequest.Create(requestPath);
            ftpRequest.Credentials = new NetworkCredential(client.Login, client.Password);
            ftpRequest.Method = WebRequestMethods.Ftp.DeleteFile;

            var response = (FtpWebResponse)await ftpRequest.GetResponseAsync();

            client.GetResponseCode(response.StatusDescription);
        }
        public async Task UploadFile(File file, FileServerClient client)
        {
            var requestPath = client.GetRequestPath(file.Name);
            var ftpRequest = (FtpWebRequest)WebRequest.Create(requestPath);
            ftpRequest.Credentials = new NetworkCredential(client.Login, client.Password);
            ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;

            ftpRequest.ContentLength = file.Content.Length;

            using (Stream ftpUploadStream = ftpRequest.GetRequestStream())
            {
                await ftpUploadStream.WriteAsync(file.Content, 0, file.Content.Length);
            }

            client.GetResponseCode(((FtpWebResponse)ftpRequest.GetResponse()).StatusDescription);
            if (client.ServerResponse != ServerResponseCode.FileUploaded)
            {
                client.ServerResponse = ServerResponseCode.GlobalError;
            }
        }
        private void ChangeCurrentDirectoryOrCreateDirectory(string directory, FileServerClient client)
        {
            List<string> directories = GetDirectoriesList(client);

            if (!directories.Contains(directory))
            {
                var requestPath = client.GetRequestPath(directory);
                var ftpRequest = (FtpWebRequest) WebRequest.Create(requestPath);
                ftpRequest.Method = WebRequestMethods.Ftp.MakeDirectory;
                ftpRequest.Credentials = new NetworkCredential(client.Login, client.Password);

                var response = (FtpWebResponse) ftpRequest.GetResponse();
                client.GetResponseCode(response.StatusDescription);
                if (client.ServerResponse == ServerResponseCode.FolderCreated)
                {
                    client.CurrentLocation += ("/" + directory);
                }
            }
            else
            {
                client.CurrentLocation += ("/" + directory);
                client.ServerResponse = ServerResponseCode.FolderExists;
            }
        }