Writes account to db