public void PostGlobalComplexData(ComplexDataRequest complexDataRequest) { try { if (complexDataRequest == null) { throw new WebFaultException <string>("", HttpStatusCode.MethodNotAllowed); } var collection = complexDataRequest.ToCollectionName(); if (collection == null) { throw new WebFaultException <string>("", HttpStatusCode.MethodNotAllowed); } MongoConnection mongoConnection = new MongoConnection(mongoConnectionString, mongoDatabaseName); Enum.TryParse(complexDataRequest.Delay, out Delay delay); var response = mongoConnection.GetData(complexDataRequest.ToCollectionName(), DateTime.Parse(complexDataRequest.From), DateTime.Parse(complexDataRequest.To), delay); throw new WebFaultException <string>(response, HttpStatusCode.OK); } catch { } }