public function generateUniqueUsername($lastname, $firstname, $iteration = 0)
    {
        $username = strtolower(str_replace(' ', '', $lastname).substr($firstname, 0, 1));

        if ($iteration != 0) {
            $username = $username.$iteration;
        }

        $usernames = count($this->db->table('users')->where('username', '=', $username)->get());

        if ($usernames > 0) {
            return $this->generateUniqueUsername($lastname, $firstname, $iteration + 1);
        }

        return $username;
    }