public List<Friend> getAllFriends() {
   try {
     // TODO In some cases cache the data is the best practice.
     List<Friend> fl = dao.getAllFriends();
     return fl;
   } catch (Exception e) {
     // in case of error, return empty list.
     return new ArrayList<Friend>();
   }
 }
  /*
   * Add friend to the data source.
   */
  public void addFriend(Friend f) {

    try {
      // add the friend to the data base and use the returned friend and add it ti the local cache.
      // the friend that returned from the DAO contain the id of the entity.
      Friend retFriend = dao.addFriend(f);
      if (retFriend == null) return;
      // update what ever it will be.
      invokeDataSourceChanged();
    } catch (Exception e) {
      Log.e("MainController", e.getMessage());
    }
  }
 /*
  * remove friend from the data source.
  *
  */
 public void removeFriend(Friend f) {
   // remove the friend from the database.
   dao.removeFriend(f);
   invokeDataSourceChanged();
 }