//needs tests public int CreateOrder(Order_x order) { string UID = CheckJWT(WebOperationContext.Current); var user = repository.GetUserByUID(UID); //var sitter = repository.GetSitterByUID(UID); if ((order.Pet.UserId != 0 & user.Id != order.Pet.UserId) && (order.Sitter != null & order.Sitter.UID != UID)) { throw new Exception("UidProvideUserDontMachWithAuthUid"); } return(repository.CreateOrder(order)); }