Updated the Repository model to use the SQL instead of arel
Added the SQL methods for Repository and removed the Arel methods
Merge branch 'working'