public static Staff Parse(SerializableStaff staff) { if (staff == null) { return(null); } UserCard userCard = null; User user = null; Position position = null; Credentials credentials = null; Department department = null; Section section = null; Team team = null; if (staff.ErtisUser != null && staff.ErtisUser.Card != null) { userCard = SerializableUserCard.Parse(staff.ErtisUser.Card); } if (staff.ErtisUser != null) { user = SerializableUser.Parse(staff.ErtisUser); } if (staff.Position != null) { position = SerializablePosition.Parse(staff.Position); } if (staff.UserCredentials != null) { credentials = SerializableCredentials.Parse(staff.UserCredentials); } if (staff.Department != null) { department = SerializableDepartment.Parse(staff.Department); } if (staff.Section != null) { section = SerializableSection.Parse(staff.Section); } if (staff.Team != null) { team = SerializableTeam.Parse(staff.Team); } return(new Staff(staff.Id, user, position) { PositionId = staff.PositionId, UserId = staff.UserId, CredentialsId = staff.CredentialsId, UserCredentials = credentials, DepartmentId = staff.DepartmentId, Department = department, Section = section, SectionId = staff.SectionId, Team = team, TeamId = staff.TeamId }); }