class JobRequestHelper {

    public JobResult removeBranch(final String jobId,
                                  final String spaceName,
                                  final String projectName,
                                  final String branchName,
                                  final String userIdentifier) {

        JobResult result = new JobResult();
        result.setJobId(jobId);

        final WorkspaceProject project = workspaceProjectService.resolveProject(
                spacesAPI.getSpace(spaceName),
                projectName);

        if (project == null) {
            result.setStatus(JobStatus.RESOURCE_NOT_EXIST);
            result.setResult("Project [" + projectName + "] does not exist");
            return result;
        }

        try {
            workspaceProjectService.removeBranch(branchName,
                                                 project,
                                                 userIdentifier);
            result.setStatus(JobStatus.SUCCESS);
        } catch (Exception e) {
            result.setStatus(JobStatus.FAIL);
            result.setResult(e.getMessage());
        }

        return result;
    }

}