public static String createAdminUser() {
    StringBuilder sql = new StringBuilder();
    String name = "Admin";
    String userName = "******";
    String salt = PasswordUtil.generateRandomSalt();
    String password = PasswordUtil.generatePasswordHash("admin", salt);

    sql.append(" INSERT INTO ");
    sql.append(UserContract.TABLE);
    sql.append(" ( ");
    sql.append(UserContract.NAME + " , ");
    sql.append(UserContract.USER_NAME + " , ");
    sql.append(UserContract.PASSWORD + " , ");
    sql.append(UserContract.SALT);
    sql.append(" ) ");
    sql.append(" VALUES ");
    sql.append(" ( ");
    sql.append("'" + name + "' , ");
    sql.append("'" + userName + "' , ");
    sql.append("'" + password + "' , ");
    sql.append("'" + salt + "'");
    sql.append(" ) ");

    return sql.toString();
  }
  @Override
  public User.LoginAction login(User user) {
    DataBaseHelper helper = new DataBaseHelper(AppUtil.CONTEXT);
    SQLiteDatabase db = helper.getReadableDatabase();
    User.LoginAction loginAction = User.LoginAction.USER_DO_NOT_EXISTS;

    String where = UserContract.USER_NAME + " = ?";
    String[] args = {user.getUserName()};
    Cursor cursor =
        db.query(UserContract.TABLE, UserContract.COLUMNS, where, args, null, null, null);

    User dataBaseUser = UserContract.bind(cursor);

    db.close();
    helper.close();

    if (dataBaseUser != null) {
      String loginPassword =
          PasswordUtil.generatePasswordHash(user.getPassword(), dataBaseUser.getSalt());

      if (loginPassword.equals(dataBaseUser.getPassword())) {
        loginAction = User.LoginAction.SUCCESS;
        dataBaseUser.createLoginSession();
      } else loginAction = User.LoginAction.INVALID_PASSWORD;
    }

    return loginAction;
  }