public IHttpActionResult CreateApartment(ApartmentBindingModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { Cad.CreateApartment(model.Level, model.Number, model.TenantsAllowed, model.FacingDirection, User.Identity.GetUserId()); } catch (ConnectedApartmentsException e) { return(BadRequest(e.Message)); } catch (Exception) { return(InternalServerError()); } return(GetResponse()); }