anchor.diff:  %% Internal functions
   %% ====================================================================
   
  +%% Get news
   get_from_db(Req) ->
   	Id = get_id(Req),
  -	case Id of
  -		0 ->
  -			Resp = mnesia_news:get_all_news();				
  +	case  Id of
  +		{fail, Error} ->
  +			 Error;
  +		_ when Id =< 0 ->
  +			 Resp = mnesia_news:get_all_news(),				
  +			 convert_response(Resp);
   		_ ->
  -			Resp = mnesia_news:get_news(Id)
  -	end,
  +			 Resp = mnesia_news:get_news(Id),
  +			 convert_response(Resp)
  +	end.
  +
  +convert_response(Resp)->
   	case Resp of
   		{atomic, Result} ->
   			Responce = lists:reverse(convert_news(Result, [])),			
  
positive.code: 	{[{<<"application/json">>, create_paste}],Req, State}.
  
  delete_resource(Req, State) ->
  	Id = get_id(Req),
  	Result = mnesia_news:delete_news(Id),
  	Body = result_to_json(Result),
  	cowboy_req:reply(200, #{}, Body, Req),
  	{ok, Req, State}.
  
  create_paste(Req, State) ->
  	
  
negative.code: 	Content.
  
  get_id(Req) ->
  	Number = cowboy_req:binding(paste_id, Req, <<"0">>),
  	try erlang:binary_to_integer(Number) 	
  	catch
  	   error:badarg -> {fail, <<"{\"error\": \"Wrong news_id path variable.\"}">>}
  	end.
  	
  %% Convert db data for rest representation
  