public void mainbtnLoginOnClick(View view)
        {
            bool isValid = true;

            if (string.IsNullOrWhiteSpace(_usernameText.Text))
            {
                _usernameText.SetError("Podaj e-mail", null);
                isValid = false;
            }

            if (string.IsNullOrWhiteSpace(_passwordText.Text))
            {
                _passwordText.SetError("Podaj hasło", null);
                isValid = false;
            }

            if (isValid)
            {
                SetLoading(true);

                var user = new UserModel
                {
                    Email    = _usernameText.Text.Trim(),
                    Password = _passwordText.Text.Trim(),
                    IsAdmin  = false
                };

                Task.Run(() =>
                {
                    if (!Repository.IsInitialized)
                    {
                        Repository.Load();
                    }

                    var storedUser = Repository.Users.Where(u => u.Email == user.Email).FirstOrDefault();

                    if (storedUser == null)
                    {
                        user.Id = Repository.Users.Count + 1;

                        var statistics = new StatisticModel
                        {
                            UserId        = user.Id,
                            AcceptedCount = 0,
                            RejectedCount = 0
                        };

                        Repository.Users.Add(user);
                        Repository.Statistics.Add(statistics);

                        storedUser = user;
                    }

                    CurrentSession.UserId = storedUser.Id;

                    Thread.Sleep(1000);
                })
                .ContinueWith(result => RunOnUiThread(() =>
                {
                    SetLoading(false);

                    Intent intent = new Intent(this, typeof(MenuActivity));
                    StartActivity(intent);
                }));
            }
        }
 private void ViewModel_ActionError(object sender, string e)
 {
     _editTextUsername.SetError(e, null);
 }