/**
   * Inserts a Post object into the local database
   *
   * @param context
   * @param post
   * @return
   */
  public static boolean insertPost(Context context, Post post) {
    if (findPostById(context, post.getId()) != null) {
      Log.i(TAG, "Post already exists in database, not inserting!");
      return updatePost(context, post);
    }

    ContentValues values = postToContentValues(post);

    DatabaseWrapper databaseWrapper = new DatabaseWrapper(context);
    SQLiteDatabase database = databaseWrapper.getWritableDatabase();

    boolean success = false;
    try {
      if (database != null) {
        long postId = database.insert(PostORM.TABLE_NAME, "null", values);
        Log.i(TAG, "Inserted new Post with ID: " + postId);

        for (Tag tag : post.getTags()) {
          TagORM.insertTag(context, tag, post.getId());
        }
        success = true;
      }
    } catch (NullPointerException ex) {
      Log.e(TAG, "Failed to insert Post[" + post.getId() + "] due to: " + ex);
    } finally {
      if (database != null) {
        database.close();
      }
    }

    return success;
  }