Moved some logic out of the raml repository and into the raml controller.