anchor.diff:  	    {error, bad_date}
       end.
   
  +success(Result) ->
  +    io:format("Success: ~p", [Result]),
  +    ok.
  +
  +error(Reason) ->
  +    io:format("Error: ~p", [Reason]),
  +    error.
  +
   %%
   %% Org
   %%
   action(org, add, Args) ->
       {[[Name]], Metadata} = getopt(["name"], Args),
  -    call(org, add, [#uce_org{name=Name, metadata=Metadata}]);
  +    case call(org, add, [#uce_org{name=Name, metadata=Metadata}]) of
  +	{ok, created} ->
  +	    success(created);
  +	{error, Reason} ->
  +	    error(Reason)
  +    end;
   
   action(org, get, Args) ->
       {[[Name]], _} = getopt(["name"], Args),
  -    Response = call(org, get, [Name]),
  -    format(Response, record_info(fields, uce_org));
  +    case call(org, get, [Name]) of
  +	{ok, Record} ->
  +	    display(json, Record, record_info(fields, uce_org));
  +	{error, Reason} ->
  +	    error(Reason)
  +    end;
   
   action(org, update, Args) ->
       {[[Name]], Metadata} = getopt(["name"], Args),
  -    call(org, update, [#uce_org{name=Name, metadata=Metadata}]);
  +    case call(org, update, [#uce_org{name=Name, metadata=Metadata}]) of
  +	{ok, updated} ->
  +	    success(updated);
  +	{error, Reason} ->
  +	    error(Reason)
  +    end;
   
   action(org, delete, Args) ->
       {[[Name]], _} = getopt(["name"], Args),
  -    call(org, update, [Name]);
  +    case call(org, delete, [Name]) of
  +	{ok, deleted} ->
  +	    success(deleted);
  +	{error, Reason} ->
  +	   error(Reason)
  +    end;
  +
  +action(org, list, _Args) ->
  +    case call(org, list, []) of
  +	{ok, Records} ->
  +	    display(json, Records, record_info(fields, uce_org));
  +	{error, Reason} ->
  +	    error(Reason)
  +    end;
   
   %%
   %% Meeting
  
positive.code: action(meeting, add, Args) ->
      {[[Name], [Org], Start, End], Metadata} =
  	getopt(["name", "org", "start", "end"], Args),
      call(meeting, add, [#uce_meeting{id=[Org, Name],
  				     start_date=parse_date(Start),
  				     end_date=parse_date(End),
  				     metadata=Metadata}]);
  
  action(meeting, delete, Args) ->
      {[[Name], [Org]], _} = getopt(["name", "org"], Args),
      call(meeting, delete, [{Org, Name}]);
  
  action(meeting, get, Args) ->
      {[[Name], [Org]], _} = getopt(["name", "org"], Args),
      call(meeting, get, [{Org, Name}]);
  
  action(meeting, update, Args) ->
      {[[Name], [Org], Start, End], Metadata} =
  	getopt(["name", "org", "start", "end"], Args),
      call(meeting, update, [#uce_meeting{id=[Org, Name],
  					start_date=parse_date(Start),
  					end_date=parse_date(End),
  					metadata=Metadata}]);
  
  action(meeting, list, Args) ->
      case getopt([name, status], Args) of
  	{[[Name], [Status]], _} ->
  	    call(meeting, list, [Name, Status]);
  	{[[Name]], _} ->
  	    call(meeting, list, [Name, "all"])
      end;
  
  %%
  %% Utils
  
negative.code: 	    case catch action(list_to_atom(Object),
  			      list_to_atom(Action),
  			      args_to_dictionary(Command)) of
  		ok ->
  		    io:format("~n"),
  		    init:stop(0);
  		error ->
  		    io:format("~n"),
  		    init:stop(2);
  		Exception when is_list(Exception) ->
  		    io:format("Fatal: " ++ Exception ++ "~n"),
  		    init:stop(2);
  		Exception ->
  		    io:format("Fatal: ~p~n", [Exception]),
  		    init:stop(2)
  	    end;
  	_ ->
  	    usage()
      end,
      halt().
  