public void CreateItem(string project, string app, string resource, string format, Stream stream) { Response response = new Response(); try { format = MapContentType(project, app, format); if (format == "raw") { throw new Exception(""); } else { XElement xElement = _adapterProvider.FormatIncomingMessage(stream, format); response = _adapterProvider.Create(project, app, resource, format, new XDocument(xElement)); } } catch (Exception e) { response.Level = StatusLevel.Error; response.Messages.Add(e.Message); } PrepareResponse(ref response); _adapterProvider.FormatOutgoingMessage <Response>(response, format, false); }