Отрефактори и оптимизируй код C# код (в ответе напиши только готовый код без всяких пояснений):
using HelperSharp;
using EmailSoftWare.Models.Connections;
using static EmailSoftWare.Models.Connections.SQLite;
using static EmailSoftWare.Models.Connections.ServerResponseParser;
using EmailSoftWare.Models.Extensions.Enums;
using EmailSoftWare.Views.Windows;
using Microsoft.Data.Sqlite;
using System;

namespace EmailSoftWare.Models.UserData
{
    public class Account
    {
        public string Type { get; set; }
        public string FullData { get; private set; }
        public string Email { get; private set; }
        public string Password { get; private set; }
        public string Domain { get; private set; }
        public int Errors { get; set; }
        public Result Result { get; set; }
        public string Server { get; set; }
        public int Port { get; set; }

        public Account(string fullData)
        {
            var dataParts = fullData.Split(":");
            FullData = fullData;
            Email = dataParts[0];
            Password = dataParts[1];
            Errors = 0;
            Result = Result.ToCheck;
        }

        public bool SetServer()
        {
            string domain = Email.Split("@")[1];
            Domain = domain;

            try
            {
                string md5 = MD5Helper.Encrypt(domain + "985B5C1D89379FBD141A86AE97169D63").ToUpper();

                if (RetrieveServerSettings(md5, "IMAP") || RetrieveServerSettings(md5, "POP3"))
                {
                    return true;
                }

                ViewManager.MainWindow.DomainsForSearchSettings.Add(domain);

                return false;
            }
            catch
            {
                ViewManager.MainWindow.DomainsForSearchSettings.Add(domain);
                return false;
            }
        }

        private bool RetrieveServerSettings(string md5, string serverType)
        {
            SqliteCommand sqLiteCommand = new SqliteCommand($"SELECT Server, Port, Socket FROM '{md5[0]}' WHERE Domain = '{md5}'",
                serverType == "IMAP" ? sqLiteConnectionImap : sqLiteConnectionPop3);

            using (SqliteDataReader sqLiteDataReader = sqLiteCommand.ExecuteReader())
            {
                if (!sqLiteDataReader.Read()) return false;

                Type = serverType;
                Server = sqLiteDataReader.GetString(0);
                Port = sqLiteDataReader.GetInt32(1);
                return true;
            }
        }
    }
}