private bool TryLogin(string username, string password, out string message, out Data.User user)
        {
            var repo = new UsersRepository();
            Users users;

            if (repo.TryGet(out users))
            {
                user = users
                    .Items
                    .FirstOrDefault(u =>
                        u.UserName.Equals(username, StringComparison.OrdinalIgnoreCase)
                    );

                if (user == null)
                {
                    message = "That user is not registered.";
                    return false;
                }

                if (user.Password != password)
                {
                    message = "Incorrect password.";
                    return false;
                }

                message = "Login successful.";
                return true;
            }

            throw new DataException("Unable to retrieve users from database.");
        }
 private bool TryCreateUser(out Data.User user)
 {
     user = ParseParameters();
     var repository = new UsersRepository();
     return repository.TrySave(user);
 }