private async void RegisterButton_ClickAsync(object sender, EventArgs e)
        {
            RegisterButton.Enabled = false;
            if (!ValidateInput())
            {
                RegisterButton.Enabled = true;
                return;
            }
            var newUser = new User
            {
                Name     = FullNameTextBox.Text,
                Email    = UserNameTextBox.Text,
                Password = PasswordTextBox.Text
            };

            try
            {
                var registeredUser = await _service.RegisterAsync(newUser);

                Success?.Invoke(this, registeredUser);
                DialogResult = DialogResult.OK;
                Close();
            }
            catch (UserAlreadyRegisteredException)
            {
                ErrorLabel.Visible = true;
            }

            RegisterButton.Enabled = true;
        }
        public async Task <IActionResult> Register([FromBody] WorkspaceDto workspaceDto)
        {
            if (await _userQueryService.IsEmailRegisteredAsync(workspaceDto.Email))
            {
                throw new Exception($"Email \"{workspaceDto.Email}\" is already taken");
            }

            var workspaceId = await _workspaceCommandService.RegisterAsync(workspaceDto.WorkspaceName);

            var userId = await _userCommandService.RegisterAsync(workspaceDto.Email, workspaceDto.Password, workspaceDto.DisplayName, workspaceId);

            await _workspaceCommandService.UpdateOwnerIdAsync(workspaceId, userId);

            await _channelCommandService.AddDefaultChannelsToNewWorkplaceAsync(userId, workspaceId);

            await _channelCommandService.AddUserToDefaultChannelsAsync(userId, workspaceId);

            await _conversationCommandService.StartSelfConversationAsync(userId, workspaceId);

            return(Ok());
        }